SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Thread: Forcing Frames

Hybrid View

  1. #1
    SitePoint Zealot Run2Web's Avatar
    Join Date
    Apr 2002
    Location
    Indiana
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Forcing Frames

    Ok, I know, frames are yucky but for now this site uses them. Problem is this, the search engines are great at putting this site in the first 2 pages but it is the page that goes in the main frame and without the frames there is no navigation. To make a long story short I used the JavaScript that I found at http://www.webreference.com/js/tips/000405.html that shows me how to force the frames to appear.

    My problem is this:

    When I try to implement this code on files that are in subdirectories, and there is a ton of them, it doesn't work. What it ends up doing is showing the URL like this:

    http://www.mysite.com/subdir1/subdir2/index.shtml?subdir1/subdir2/pagename.shtml&2

    Any ideas how to make it work?
    Last edited by Run2Web; Oct 25, 2002 at 12:59.
    RUN2Web

    Has Anyone seen my Furry Little Mind?

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wrote a script a while back to do that. It's about a year old or older, but should still work. Documentation is in the JS file. Uses cookies instead of the search string.

    http://www.peterbailey.net/js/superframes.js

    I think I modified it once to use the search string instead though, if that's what you need.

    Let me know...
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    SitePoint Wizard Bill Posters's Avatar
    Join Date
    Dec 2001
    Location
    UK
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this force rames method instead.

    It may help as it is non-specific. It simply checks whether the current page (a page that should be in a frameset) is currently the top page in the window. If it is then it forwards the browser to whatever page you specify as the frameset page.
    The absence of a specific url check may make the difference.
    Code:
    <script type="text/javascript">
    
    if (top.location.href == self.location.href) {
        window.location.href = 'yourframesetpage.html'
    }
    
    </script>
    You should still be able to customise it if you wish, by specifying the frames to be included just as was done in the script you have been using so far.

    Being generic, you can also use it on each page without the need to customise it for each url.

    If you are using it on many pages you might find it more efficient to place it in an external js file as a function and call it by function name in the header of each page (rather than have the full script on every page).

    Worth a try
    Last edited by Bill Posters; Oct 26, 2002 at 00:29.
    New Plastic Arts: Visual Communication | DesignateOnline

    Mate went to NY and all he got me was this lousy signature

  4. #4
    SitePoint Zealot Run2Web's Avatar
    Join Date
    Apr 2002
    Location
    Indiana
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Thank you for this script!

    The documentation states that portions of the file will not work with files within subdirectories. That is the problem that I am having. Will the newer version of this that uses the cookies work with files located in subdirectories? I'm not really clear on this.

    Thanks,

    Michelle
    RUN2Web

    Has Anyone seen my Furry Little Mind?

  5. #5
    SitePoint Zealot Run2Web's Avatar
    Join Date
    Apr 2002
    Location
    Indiana
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks,

    I will give it a try, as I am getting fairly frustrated.
    RUN2Web

    Has Anyone seen my Furry Little Mind?

  6. #6
    + platinum's Avatar
    Join Date
    Jun 2001
    Location
    Adelaide, Australia
    Posts
    6,441
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Please don't double post, i've merged these two threads together...

  7. #7
    SitePoint Zealot Run2Web's Avatar
    Join Date
    Apr 2002
    Location
    Indiana
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by Bill Posters
    Try this force rames method instead.

    Code:
    <script type="text/javascript">
    
    if (top.location.href == self.location.href) {
        window.location.href = 'yourframesetpage.html'
    }
    
    </script>
    Worth a try
    Sorry, this didn't work on the files that are in subdirectories.

    This site has so many pages that it needs the subdirectories and the client is not ready to redesign the site yet.
    RUN2Web

    Has Anyone seen my Furry Little Mind?

  8. #8
    SitePoint Zealot Run2Web's Avatar
    Join Date
    Apr 2002
    Location
    Indiana
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by beetle
    I wrote a script a while back to do that. It's about a year old or older, but should still work. Documentation is in the JS file. Uses cookies instead of the search string.

    http://www.peterbailey.net/js/superframes.js

    I think I modified it once to use the search string instead though, if that's what you need.

    Let me know...
    This doesn't work for the subdirectories. It loads the subdirectory and then calls index.shtml which is the name of my frameset. I need it to show options.shtml in the main frame.
    RUN2Web

    Has Anyone seen my Furry Little Mind?

  9. #9
    SitePoint Zealot Run2Web's Avatar
    Join Date
    Apr 2002
    Location
    Indiana
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by platinum
    Please don't double post, i've merged these two threads together...
    Sorry, didn't realize I did.
    RUN2Web

    Has Anyone seen my Furry Little Mind?


Bookmarks

Posting Permissions

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