SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Member BillDugan's Avatar
    Join Date
    Jul 2003
    Location
    Casey, IL
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Orphaned frame page redirect?

    I have designed a website using frames. The site has been indexed by Google - actually, 2 pages of the frameset have been indexed. And neither has working navigation. Is there a bit of JavaScript that will detect if a page is part of a frameset and if not, then redirect to the index page frameset?

    TIA - Bill Dugan

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2003
    Location
    Vancouver, BC, Canada
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    function toframes() {
        if (self == top) 
            window.open("http://example.com/frameset.html","_top","location=no,status=no,toolbar=no");
    }
    then call the function with:
    Code:
    <body onLoad="toframes()">

  3. #3
    SitePoint Enthusiast Setac's Avatar
    Join Date
    Nov 2000
    Location
    San Marcos CA
    Posts
    83
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Lightbulb

    There are all sorts of scripts to handle this problem. Most just call a basic framset without regard for the page found. Search engines are not fond of sites that do this with redirects are often penalized. I wanted to have the Ferrari a visitor found via a search come up when the framset was loaded.

    I have a site with 2 standard frames both of which can have any number of pages loaded in the frame set. I designed the frameset to read the querystring and load the main frame according to a passed variable. All of the 'framed' pages include a script that calls the frameset and passes the page name in the URL call.

    Code:
     <!----// Include File - Javascript
     // Test if in frame
     var sName = "ferrari_inventory";   // window name to look for...
     var tName = "ferrari_frame.html"   // frame parent's file name
     //---------------------------------------------------------------------
     tName =  tName + "?";
     var sThisPage = window.location + "";  // get this window name 
     // --- Strip name to page name
     var sReg  =  /\//;	   //set search string
     var i = sThisPage.search( sReg);   //search for / symbol
     do {
      sThisPage = sThisPage.slice( i);
      i = sThisPage.search( sReg) +1;
     } while( i > 0);
     var hName = tName + sThisPage;	// host frame page to goto
     if( window.self.name != sName )  {
    				location.replace(hName);
      }
     //-->
    sName holds the name of the frame being targeted. If the page is not loaded within this frame, it then calls the parent frameset. The frame name is used to reduce use of these pages by other web sites.

    tName holds the name of the framset to call. This lets me use the script with either framset.

    The script then finds the current page name and builds it into a call to the framset.

    Location.replace is used to avoid creating a mouse trap.
    Dynamic HTML - Is that a Frisbee based language...


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
  •