Skip to content

Instantly share code, notes, and snippets.

@TastyToast
Created May 4, 2012 21:33
Show Gist options
  • Save TastyToast/2597871 to your computer and use it in GitHub Desktop.
Save TastyToast/2597871 to your computer and use it in GitHub Desktop.
Open link in new window with pure javascript
<script type="text/javascript">
window.onload = function(){
var anchors = document.getElementById('main_tab_sponsor').getElementsByTagName('a');
for (var i=0; i<anchors.length; i++){
anchors[i].setAttribute('target', '_blank');
anchors[i].setAttribute('href', "http://www.myurl.com")
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment