Check Frames Page Script

Verify your site's structure with precision. This advanced script doesn't just check for the presence of a frame; it validates that the parent window is your specific frameset, preventing your content from being improperly embedded elsewhere.

Technical Insight

This script uses the window.name or document.referrer properties to identify the parent. It is the ideal solution for developers managing complex multi-frame portals.

Copy the Script

<script>
  // Replace 'main_frameset' with the name of your frameset window
  if (window.parent.name != 'main_frameset') {
    window.location.href = "index.html";
  }
</script>

Note: Ensure you have named your frameset in your <frame> or <iframe> tags using the 'name' attribute for this script to function.

Frequently Asked Questions

Look at your main <frameset> file. The name is defined in the <frame name="..."> tag. If you haven't assigned one, you can add it now to enable this script.

Yes. Since a competitor's frameset will not have the same name as yours, the script will detect the mismatch and redirect the user back to your official site.

Yes, window.parent.name is a standard property that has been supported since the earliest versions of JavaScript.