I'm making a website that has another website embedded in an object (a small box in my page). I'm looking for as solution that will allow me to hide this object when the webpage in the embedded object changes (ie the user clicks a link on that website)
The code I have below will only shows will create the embedded object but everything is static (ie the "src" will not change as the URL changes in the object).
<object data=http://www.website.com width="600" height="400"> <embed id="test" src=http://www.website.com width="600" height="400"> </embed> Error: Embedded data could not be displayed. </object>
Is there a way to look at the current URL of that object? I've been thinking about using something similar to location.href but I'm not sure how to implement this.
Thanks
Sorry, due to browser policy, you can not do that, you can only get iframe url if it open a page within your domain. For more information you can search "get iframe url" within stackoverflow
If your site is in the same domain, you think you can do like this
var url = http://www.website.com";
function checkChange(){
if (document.getElementBydId('test').src != url){
alert('page change');
}
}
setInterval(checkChange, 1000);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.