Detecting frames

javascript United States
  • 19 years ago

    Hi all! Does anyone have a java script that I can use in HTML pages in order to detect whether a page is being displayed in a frame, and if not, redirect the browser to another page?


    Any help is greatly appreciated!

  • 19 years ago

    Heres a little snippet from the HotHTML 2001 Professional website. which  you can use to find out about your clients framing. If your using ASP try using the 'Response.Redirect' method.


    <SCRIPT LANGUAGE="JAVASCRIPT">
    <!-- hide from older browsers
    // Frame Detector 2000
    // Developed by Thushan Fernando
    // Date Released :27/09/98
    // Version : 1.00


    if (top == self) {
       document.write ("<p align='right'><font face='Tahoma'>You are using the no Frames version.</font></p>");
    }
    else
       document.write ("<p align='right'><font face='Tahoma'>You are using the Frames version.</font></p>");
    // -->


    </SCRIPT>


    Peace

  • 19 years ago

    Thanks!


    I also need to redirect the browser using java script. And, is it possible to detect frames using ASP?

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Theory is when you know something, but it doesn't work. Practice is when something works, but you don't know why. Programmers combine theory and practice: Nothing works and they don't know why.”