July 15, 2010
What happens if your page get found on Google but it should be inside an iframe? For me the answer was simple, detect if you’re inside an iframe and if not redirect to the destination you want.
To find out if you’re in an iframe you can get the number of frames from the parent window. If the number of frames if less than 0, you’re not in an iframe and you need to redirect. The same principle can be used to escape from an iframe.
if ( window.parent.frames.length>0 ) {} // check how many frames, if none do nothing else { window.location="[new destination]"; // else change the current location }Filed under: Programming — Tags: iframe, javascript — admin @ 8:49 pm
No comments yet.
RSS feed for comments on this post. TrackBack URL
Handy tools for creating the various cards the game uses, dungeon, magic, event and treasure
Create your own unexpected event cards
Create your own monster event cards
Powered by WordPress