Skip to content

Instantly share code, notes, and snippets.

@obenjiro
Created March 18, 2014 21:35
Show Gist options
  • Save obenjiro/9630243 to your computer and use it in GitHub Desktop.
Save obenjiro/9630243 to your computer and use it in GitHub Desktop.
window.onload = function(){
var iframeholder = document.getElementById('iframeholder');
var test = document.createElement('iframe');
var base = document.createElement('base');
base.setAttribute('target', '_parent')
test.onload = function(){
var y = (test.contentWindow || test.contentDocument);
if (y.document)y = y.document;
y.head.appendChild(base);
y.body.innerHTML = "<a href='#test'>test</a>";
};
iframeholder.appendChild(test);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment