SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Prevent iframed webpage from accessing the parent window - Is this possible?

    I'm developing a website which allows people to discover other websites they might like. It displays these websites in an iframe. Sometimes an iframed website will jump out of the iframe because the site contains javascript that will redirect the parent url if the parent window url != the website's URL.

    Is there any way to prevent the iframed website from redirecting the parent window? If not, is there any kind of script I can use that would detect if an iframed website is trying to redirect the parent window so that I can log the offending site URL and have that site automatically removed from my database?

    Thanks in advance!
    Gabe

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,687
    Mentioned
    100 Post(s)
    Tagged
    4 Thread(s)
    You can have the server parse the page and any linked js files for certain things.

    For example, if top.location.href is being checked, that's a definite signiture of such framed checking going on.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah what's what I'll probably end up doing if there is no other way.

    Thanks for the reply!
    Gabe


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •