Sunday, February 22, 2015

redirecting iframe's parent window - cross domain - javascript

just use form with the target as _parent, and the parent window will redirect, even if the domain is different, because parent.location.href etc... will result in browser security error


var f = document.createElement('form')
f.action = 'http://www.thenewurl.com/'
f.method = 'get'
f.target = '_parent'
document.body.appendChild(f)
f.submit()


No comments: