Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    New Coder
    Join Date
    Feb 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    prevent breaking out of frames

    Hi everyone.

    There are plenty of scripts that if your webpage gets displayed in a frame they will break out of it. Now my problem. Is it possible to prevent this breaking out of frames and forcing the webpage to display in a frame?

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    If you don't own the page, you can't. Are you trying to frame external sites? For security reasons, javascript doesn't have access to pages in other domain. Imagine your site can be manipulated by other sites, would you want that?
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New Coder
    Join Date
    Feb 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I wouldnt want that my pages gets changed by a different script.

    So there is really no way that makes it possible to prevent that? As said I only want to prevent the breaking out of frames nothing else.

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    No way. You need to programmatically change the code for frame breakout script, so if you allow other sites to change your code, it would open a big hole for malicious things that would make the web a mess.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #5
    New Coder
    Join Date
    Feb 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok. Thanks for your help.

  • #6
    New Coder
    Join Date
    Jun 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi! I'm having similar problem. My website has some pages which appear in frames from external sources. It has been agreed with the owner of the other site that the pages I link to have 'no break out of frame script'. But a few times I had the problem where for some reason they have forgotten about me and included the script again.

    Does anyone know if it is possible to detect a page that will break out of the frames? If this possible I would like to be able to detect it and if it I going to break out of the frames have an alterative page load instead. Also have similar problem where the page has be removed and then nothing loads. Detecting before it loads and having an alterative page would also solve this problem.

    Any Ideas? Thank you

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    There isn't anything you can do because there is no way for javascript to read the external page, sorry.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #8
    New Coder
    Join Date
    Jun 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I know javascript can't read the external page. Is there anything else that could?

    Is there anyway without reading the external page. Is it possible to catch the page as it loads in the current browser?

  • #9
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You are still going to have to read the external page some how. You might be able to do with the php file_get_contents() function. It returns the code of a page as a string. You can try searching for the elements that are common in break out of frames script and if found load a different page by echoing out a javascript or meta redirect. Pay attention to this tip on the php.net page
    Quote Originally Posted by php.net
    Tip: You can use a URL as a filename with this function if the fopen wrappers have been enabled. See fopen() for more details on how to specify the filename and Appendix M for a list of supported URL protocols.
    I don't know if this is enabled by default.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #10
    New Coder
    Join Date
    Jun 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi! can anyone help me solve this? can anyone write me some script? can't afford to pay you much but we can discuss it and come to some sort of arrangement. Not post in "Paid work offers and requests" as I'm not sure if want I'm asking is possible.

  • #11
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Did you even read my post?
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #12
    New Coder
    Join Date
    Jun 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, I have read your post! Not filmar with php. And would the way you suggested would mean i would have find to every possible script that could break frames and if missed one it might not work?

  • #13
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Yep if you missed one, it won't work correctly.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #14
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    If it is your page and you want it to always appear within frames then you can add javascript to your page that will load the frameset when the page is accessed from anywhere except the frameset.

    See http://javascript.about.com/library/blframe.htm for more info on how to do it.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #15
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    They are wanting to replace the location of the frame with a different url if they 'detect' a break out of frames script in the external file.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •