0

One of our web pages has a huge iframe in it, allowing users to be on our website and see another website within it. When users click on the iframes website, and navigate in it, find a place they want to reference later, the url stays the same because the iframes url isnt hosted on our web site.

What i want to know, Is it possible to show the iframe URL and possibly have a link to it, have it be java or even copy to your clip board, is there another way i could "mount" the external webpage onto our webpage if the limitations of the iframe tag aren't powerful enough.

what i would like, I would like our url to change every time the user clicks on the external web page or "iframe", allowing the user to copy the URL and be linked back with our website showing the page they were in, in the external page.

I'm running out of resources.. Next step is going to the company that is hosting the external page and having me give them code to make their webpage look like ours.

Duck1337
  • 524
  • 4
  • 16
  • 1
    Possible duplicate [Get current URL from IFRAME](http://stackoverflow.com/questions/938180/get-current-url-from-iframe)? – UnholyRanger Feb 21 '13 at 21:24
  • If the domain if both pages is not the same, then this is not a simple problem. The same origin policy is going to give you problems. For one good approach to XDM (cross domain messaging) see: https://developer.mozilla.org/en-US/docs/DOM/window.postMessage – Aurand Feb 21 '13 at 21:27

1 Answers1

0

To get the iframe url do this:

$('#myiframe').bind('click', function(e) {
    var url = $("#myiframe").get(0).contentWindow.location;
});

For anything more add some code to your question.

Iron3eagle
  • 1,077
  • 7
  • 23
  • Note that this will not work if the domain of the page in the iframe is different from that of the page hosting the iframe. – Aurand Feb 21 '13 at 21:28
  • So basicly if your at `www.yourpage.com` but end up at `www.google.com` it won't work, but you shouldn't let a user have complete free reign inside an `iframe` anyway, that just leads to trouble! (Facebook, Pr0n, Productivity Loss..., or using Stackoverflow when you should be coding...) – Iron3eagle Feb 21 '13 at 21:31