jaymc Posted January 17, 2007 Share Posted January 17, 2007 I need a script that will check to see if a webpage is sitting in an IFRAME, if it isnt, take them to my homepageBasically, to stop people asking pages directly rather than through my iframeHope someone can helpHave tried a few scripts but they only with with actual Framesets and not IFRAMESCheers Quote Link to comment Share on other sites More sharing options...
mainewoods Posted January 17, 2007 Share Posted January 17, 2007 you can access the src element of your iframe like this:[code]if (document.getElementById('iframeid').src == 'yourpageurl') { // true code} else { // false code}[/code] Quote Link to comment Share on other sites More sharing options...
nogray Posted January 17, 2007 Share Posted January 17, 2007 just google "breakout of frame" and you'll find some usefull script. Alter them to do what you need. Quote Link to comment Share on other sites More sharing options...
mainewoods Posted January 18, 2007 Share Posted January 18, 2007 This page tells you how to do what you want:http://www.howtocreate.co.uk/tutorials/javascript/browserinspecific--about a third way down that page Quote Link to comment Share on other sites More sharing options...
jaymc Posted January 21, 2007 Author Share Posted January 21, 2007 Ive tried that and it still didnt workIsnt that related to framesets rather than IFRAMESHas anyone got any WORKING code that has been tested?Cheers Quote Link to comment Share on other sites More sharing options...
fenway Posted January 22, 2007 Share Posted January 22, 2007 Most people don't break out of iframes... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.