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.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Jan 2003
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Open page in frames with Open in New Window

    Dear experts,

    I am new to all this and try to make my personal web page look a little more professional

    My home pages uses 2 frames like this:
    <frameset rows="38,*" framespacing="0" border="0" frameborder="0">
    <frame name="header" scrolling="no" target="main" src="http://www.mydomain.com/home page/header.html" marginwidth="0" marginheight="0">
    <frame name="main" src="http://www.mydomain.com/home page/body.asp" scrolling="auto" noresize>
    <noframes>
    <body>

    <p>This page uses frames, but your browser doesn't support them.</p>

    </body>
    </noframes>
    </frameset>

    The 1st frame is a header with hyperlinks to the main pages on my site map. It is my menu bar. The 2nd frame is my home page. With this, anytime a user uses a hyperlink, the windows open under the header frame. So they keep the menu bar on top of all pages.

    My problem is when they click on "open in new window. Then the 1st frame is not called and they loose the menu bar.

    Any idea how to (simply... ) keep the 1st frame called on "Open in New Window" event?

    THANKS A LOT!

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Depends on the time of year
    Posts
    478
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Okay, I'm not sure I understand exactly wat the problem is so i'll just post my presumptions, if that's not what you looking for, post the link, or the code for the pages necessary (not just the page setting up the frames).

    Solution 1:
    For your links: <a href="goingtosomepage.html" target="main">Link</a>

    Solution 2: If you want to open a new window:

    <a href="javascript:void()" onclick="window.open('somelink.html','_body');">Link</a>

    Hope that helps.

    Duniyadnd

  • #3
    New Coder
    Join Date
    Jan 2003
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello duniyadnd

    Thanks for your response and your time.
    I am not sure this is what I want though...

    here is my URL: http://www.mydomain.com/main.html

    When you go there you see my home page. There is a menu bar on top of it (the 1st frame in my code example above)

    If you click on any link (on the page or the menu bar), you go to another page. The top frame (menu) stays on top.

    If you use your right click and "Open in New Window", the page opens but without the menu bar that was on the top frame.

    Thanks for your help.

    Tom
    Last edited by balltom; 01-13-2003 at 06:37 PM.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    NL
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,
    That's the problem when you use frames. Your pages can get out of their frameset.
    Here's a thread about a script that keeps them in there:
    http://www.codingforums.com/showthre...mesaver+joh6nn

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    The Netherlands, Baarn, Ut.
    Posts
    4,252
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Alternative

    Joh6nns solution mentioned is a very elegant, yet not really simple solution; alternatively, you could make a seperate frameset for each content page with the same menu document in every first frame and link to these framesets, cancelling out part of the advantages (!) of using frames.
    By the way: if you take a look a some of the better known professional sites you'll rarely find frames...
    Regards,
    Ronald.
    ronaldvanderwijden.com

  • #6
    New Coder
    Join Date
    Jan 2003
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    THANKS A LOT FOLKS.
    I have been searching with keywords to try to find such information. Was probably not using the right keywords then...

    I will definitively give it a try.
    No big deal anyways, it is just my personal web site...
    And I agree about the comment on the pros: they don't use frames. But I was not crazy about putting javascripts in all my pages. Might have to to fix this issue though. I'll see...

    You guys are great. Thanks for the time spent on this for me.

    Tom

  • #7
    Regular Coder
    Join Date
    Jun 2002
    Location
    Depends on the time of year
    Posts
    478
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you could disable right clicking on the top frame, but that doesn't help, cause anyone can just press shift with the mouse button to get the links in a new page.

    But yeah, the solution which mccookie gave is the right one, but if you want to avoid using javascript altogether, you might contemplating forgetting about this problem altogether, or you could remove frames and make it in a table format.

    If you worried that you going to keep changing your menu system, you can use server side includes (SSI) which is supported by most hosts. In thought process this is very similar to frames, but with a twist.

    eg. <!-- virtual include="/somelink.html" --> -> I think its something like that, I haven't used it in a while. Anyway, now the file that will call it is on every single page I have. somelink.html will have all the information for my menu, all i have to do is call that page on every page. If I make a single change in somelink.html, then all the changes will occur for the pages that call it. Also, another thing which I never knew about, but took me about two months to figure out (no one I knew used SSI back then), is that all the files that you use to call in another page using SSIs should have an extension of *.shtml

    Hope that gives you new ideas on solving your problem.

    Duniyadnd

  • #8
    New Coder
    Join Date
    Jan 2003
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Guys,
    For information, I looked at the options offered by Joh6nns and friends.
    Pretty cool!
    However I invented a little of my own...
    I took the simple one proposed my Mr J that reloads the frame into the main frameset:

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function LoadFrame(){
    if (self.location.search){
    parent.framename.location = location.search.substring(1,location.search.length);
    }
    }
    onload = LoadFrame
    // -->
    </SCRIPT>

    and in the pages:

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    if (self == top){
    var url = self.location;
    self.location = "frameset.htm?" + url;
    }
    // -->
    </SCRIPT>


    But instead of using the default page (problem with dial up modems mentionned by Gordo), I use a special "default" frameset that loads a blank empty page below my menu bar. Much faster to load than my original default page. Does not matter since it is replaced by the page I want to load anyways.

    Thanks a lot for your help. I would not have found this by myself!


  •  

    Posting Permissions

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