I have iframe
inside my website.
inside this iframe
user can slide into another website, which means that the url
inside the iframe
is changing according the page that display.
is it possible to have to url
inside the iframe
?
Thanks.
I have iframe
inside my website.
inside this iframe
user can slide into another website, which means that the url
inside the iframe
is changing according the page that display.
is it possible to have to url
inside the iframe
?
Thanks.
I think you can't interact with iframe as the only interaction is the initial src (or URL) supplied to the iframe .
"Because of the cross domain security restrictions in most Javascript implementations, it’s normally impossible for one HTML document to communicate with another frame, popup, or iframe unless the two pages are served from the same domain. James Burke came up with a clever solution to this problem, allowing bidirectional communication between a parent window and it’s iframe or popup." Source
What you are trying to do? what's your end result ... so that I can help
You can listen for the iFrame load event and use location to get the value.
var frame = document.getElementById("my_iframe");
frame.addEventListener('load', function (evt) {
console.log(frame.contentWindow.location.href);
}, false;
This will get you the 'URL' every time it changes.