SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Location
    Switzerland
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    frame / page reload script

    I have a problem: my page contains frames, now many people link directly to the subpages. Is it possible to implement a script that automaically reloads the page with the navigation in the other frame?
    where can I find such a script?

    thanks a lot.

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Try this maybe?
    Code:
    <script language="javascript" type="text/javascript">
    if (!top.location) {
      location.href='pageWithFrames.html';
    }
    </script>
    Where "top" is the name of one of your frames, and "pageWithFrames.html" is the page with the frameset code.

    Code is untested.

    As an aside, why frames? They are a hassle for search engines, accessibility, and user interaction alike.

    --Vinnie

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Location
    Switzerland
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks. but how can I make that in the bottom frame the page that is already loaded appears?
    thanks.

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Originally posted by raffael3d
    thanks. but how can I make that in the bottom frame the page that is already loaded appears?
    thanks.
    Let's tweak my script a bit:
    Code:
    <script language="javascript" type="text/javascript">
    //This goes in any page without a frameset
    if (!top.location) {
      var thisPage = window.location;
      location.href='pageWithFrames.html?callpage='+thisPage;
    }
    </script>
    This next one goes on your frame page
    Code:
    <script language="javascript" type="text/javascript">
    var searchIt = document.search;
    if (searchIt.length>0) {
      main.location.href = searchIt.substring(searchIt.indexOf('='), searchIt.length);
    }
    //where "main" is the name of your main frame.
    </script>
    Hope this works, I haven't tested it and I haven't worked with frames in a LONG time.

    --Vinnie


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
  •