javascript - Parent redirect when using iframe -


i know there several questions/answers how redirect parent window within iframe, 1 has slight twist.

i need able redirect parent window when page in iframe changed. however, page in iframe not on domain, can't use parent.window.location trick suggested in other threads.

so, example, if put stackoverflow.com in iframe, need parent frame redirect when user clicks link on stackoverflow page.

i doubt possible, thought there might sort of polling of iframe parent can or something.

this bit convoluted, should trick. if define iframe this

<iframe id="xmyiframe" src="http://someurl" onload="replaceload(this)" ></iframe> 

then can define javascript code;

function replaceload(oiframe) {   oiframe.onload = function () {      location.href = 'http://www.microsfot.com'   } } 

on load of initial iframe url inital onload event handler fires replaces new handler fire after next load i.e. after user clicks link in iframed page.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -