Activity Stream
48,167 MEMBERS
6735 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 3 of 3
  1.     
    #1
    Member

    Default HTML - iframe help

    Hope you can help me with this.

    I have a 3rd party website that I want to show a snippet of on MY website using iframe. Simple right?

    No.

    It seems that this 3rd party website has a tiny piece of javascript:

    Code: 
    <script type="text/javascript">     <!--         if (top.location != self.location)         { top.location = self.location.href }      //-->     </script>
    When I load my page, it then starts to load the iframe, but because of the code that they have in their script, it totally hijacks my website, and redirects to their URL.

    Is there a way to prevent this? and just keep the 3rd party website inside the iframe?

    Thanks
    Ashleyuk1984 Reviewed by Ashleyuk1984 on . HTML - iframe help Hope you can help me with this. I have a 3rd party website that I want to show a snippet of on MY website using iframe. Simple right? No. It seems that this 3rd party website has a tiny piece of javascript: <script type="text/javascript"> <!-- if (top.location != self.location) { top.location = self.location.href } //--> </script> Rating: 5

    UltraIMG - Free Image Hosting
    Want to ask me anything to do with UltraIMG?? Send me a PM.
    Chances are that if you leave a message on the forum I might not see it. :)

  2.   Sponsored Links

  3.     
    #2
    Member
    i think you wanna place ifames for url shortening sites in your website or something similar

    basically this line here

    <script type="text/javascript"> <!-- if (top.location != self.location) { top.location = self.location.href } //--> </script>
    means that the website can not be loaded within frame, if you do it will redirect to the url of the iframe you included

    so this can not be done, cuz you can not modify javascript of 3rd party website so do not waste your time

  4.     
    #3
    Respected Member
    Website's:
    DL4Everything.com Soft2050.in
    Well! You can try out to actually modify the iframe source before it is shown to user. Just wrote a sample code which does the work:

    PHP Code: 
    <html>
    <
    head><title>Test</title></head>
    <
    body>
    <
    script type="text/javascript">
    function 
    Removejsfromifram(frameid) {
        var 
    capturediframe document.getElementById(frameid);
        
    capturediframe.contentWindow.document.body.innerHTML capturediframe.contentWindow.document.body.innerHTML.replace('<script.*?type="text/javascript".*?>.*?<\/script>''');
        
    // Remove Javascript from Iframe using javascript - Soft2050
    }

    </script>
    <body>
    <iframe id="softid" src="test - Copy.html" onload="Removejsfromifram('softid')" ></iframe>
    </body>
    </html> 
    It will remove all javascript code from the source so no hijacking.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [Need Help] IFrame Plugin
    By Villa in forum Wordpress
    Replies: 1
    Last Post: 12th Apr 2012, 08:47 AM
  2. WTS: iFrame Traffic
    By ebizzz in forum Traffic Market (Buy, Sell and Trade)
    Replies: 3
    Last Post: 6th Mar 2012, 12:34 PM
  3. [Buying] Traffic iFrame/Pop up/Bux
    By EnCiPh3r in forum Completed Transactions
    Replies: 5
    Last Post: 22nd Oct 2011, 05:40 PM
  4. Trojoan.Html.Iframe.I [Guide and help]
    By sunnyx12x21x in forum General Discussion
    Replies: 0
    Last Post: 14th Oct 2010, 04:58 PM
  5. Replies: 8
    Last Post: 21st Jul 2010, 06:13 PM

Tags for this Thread

BE SOCIAL