Keep in Frames Script

Maintain your site structure. This script checks if the current page is being viewed on its own. If it is, the script redirects the visitor to your main frameset (usually the home page), ensuring they always have access to your site's navigation menu.

Structure Check

Current Status:

Checking...

This demo checks if top.location equals self.location.

Copy the Script

<script>
// Frame Enforcer Script
// Place this in the <head> of your content pages

if (top.location == self.location) {
  // Replace 'index.html' with your main frameset URL
  window.location.href = 'index.html'; 
}
</script>

Frequently Asked Questions

Search engines often index individual content pages (like 'contact.html') rather than the main frameset ('index.html'). Without this script, visitors arriving from Google might see your content without the navigation menu.

Yes. You must replace 'index.html' in the code with the actual URL of your main frameset page.

Rarely. Modern web development uses server-side includes (PHP) or Single Page Application (SPA) frameworks instead of framesets. Frames are generally bad for SEO and accessibility, but this script helps mitigate navigation issues if you are using them.