How to Break a Web Page Out from an iFrame Automatically

Javascript code to breakout a web page from underneath an iFrame.
by

A lot of social bookmarking sites are now iFraming in other websites, in order to keep traffic on their site so they get more pageviews.  In order to get around the HTML iFraming of your site, below is a little javascript code that will automatically get a web page out from underneath an iFrame. 

Place the iFrame breaking code shown below, in between the <head> and </head> tags in your html page:

    <script type="text/javascript">
    <!--
        if (top.location != self.location)
        { top.location = self.location.href }
    //-->
    </script>
 


0
0

Add your comment

by Anonymous - Already have an account? Login now!
Your Name:

Comment:
Enter the text you see in the image below
What do you see?
Can't read the image? View a new one.
Your comment will appear after being approved.

Related Posts


In the code below, you will be able to find the baseUrl of your website using javascript. The following javascript code will work when used on your localhost or when it's used in a live site (finds the root url of the domain address). Just add this...  more »

Many modern websites today use Javascript and require it to be enabled in your browser for you to experience the full features of a site. Learn how to turn on or off Javascript in your Internet Explorer 6.x browser.  more »