Skip to content

Instantly share code, notes, and snippets.

@bcarno
Last active August 31, 2016 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bcarno/e32b4a2f3579c9b66b4f18b3364ecb35 to your computer and use it in GitHub Desktop.
Save bcarno/e32b4a2f3579c9b66b4f18b3364ecb35 to your computer and use it in GitHub Desktop.
Checks to see if window is in an iframe and if it is it changes all links to open in the current window, regardless of what their previous target was. Requires jQuery to work.
var isInIframe = (self !== top) ? true : false;
$(function(){
if(isInIframe){
$('a').attr("target", "_self");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment