SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Feb 2000
    Location
    England
    Posts
    568
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    ensuring content is in frames

    I want to make sure that a page is loaded inside its frameset. This is easy enough if you don't mind just reloading the frameset just using:

    if (window == top) top.location.href = "frames.html";

    However what I want is the page i am loading to be loaded in the content frame (where it should be). Anyone with any suggestions?

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if (window == top)
    {
    top.location.href = 'frame.php?page=' + escape(location.href.substring(location.href.lastIndexOf('/') + 1));
    }

    See this thread

  3. #3
    SitePoint Evangelist
    Join Date
    Feb 2000
    Location
    England
    Posts
    568
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh brilliant! Thanks so much.

  4. #4
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up I use this method in HEAD

    I use this method in the <head> page of the html.
    I haven't tried it in an external .js file yet though.

    <script language="javascript" type="text/javascript">
    if (top.location.href.indexOf("index.html") == -1)
    top.location.href = "index.html?sales.html&2";
    </script>

    where index.html is the page that calls the frames, and sales.html is the page visited and '2' being the index of the frame.

    I use;

    <SCRIPT LANGUAGE="JavaScript">

    <!--
    if (top.location !=self.location) {
    top.location.replace(self.location)}

    var ar0 = "banner.html";
    var ar1 = "menu.html";
    var ar2 = "main.html";

    var str = location.search;
    var pos = str.indexOf("&");
    if (pos != -1) {
    var num = str.substring(pos + 1, str.length);
    window["ar" + num] = str.substring(1, pos);
    }

    // -->
    </SCRIPT>


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
  •