Results 1 to 10 of 10

Thread: open htm FILES without multiple browser windows/tabs

  1. #1
    Join Date
    Feb 2009
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default open htm FILES without multiple browser windows/tabs

    Hi
    As a user with just enough experience to try and repeatedly fail, I'm resorting to asking for help here.

    I have a number of html FILES (one.html ... ten.html) than I want to be able to open (actually by an external program call) WITHOUT opening multiple browser windows or tabs. Each html FILE simply must provide a url "link" to an https://server.somesite

    I've tried using frames, iframes, and javascript to get each newly sequential html file to open without multiple browser windows, but without success. Ideally, I would target to the 'MAIN' frame of a frameset. These are not links, but html files. I think it can be done, maybe with javascript. I could even accept the newly opened html file to window.close() right away with javascript (but did really get that working either).

    As an example of what I tried, which opens a new browser window/tab:

    <html><head><script language="JavaScript">
    <!--
    function OpenSub()
    {
    //window.parent.location='https://xx.yyy.com/something';
    //-->
    }
    OpenSub()
    </script>
    </head></html>

    Also tried things like:
    top.frames['MAIN'].location.href=
    parent.frames.MAIN.location.replace

    So:
    1) How can I target a frameset (in the same directory) from an html file (not link)?

    2) Can I do this using a meta refresh with target? With a javascript body onload? -which I tried and couldn't get working.

    3) Can I do this with a <base target="****"> tag?

    I'm using Firefox. IE doesn't work well on the sites.

    Thanks in advance!

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    I'm not really sure I understand your question, but you could try these:
    Code:
    <base target="_top">
    or
    Code:
    <base target="_parent">
    Good luck!

  3. The Following User Says Thank You to Snookerman For This Useful Post:

    hqfx (02-20-2009)

  4. #3
    Join Date
    Feb 2009
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Thanks </Snook> but that's not it.

    What I need is to have file2.html open (when called or clicked) and show up in a different window, for example [MAIN] frame of file1.html, so that the browser does not open a new window each time [alternatively I may just have to autoclose such new windows.

    Code:
    <html><head><title>file1.html</title></head>
    <FRAMESET ROWS="5%,*">
    	<FRAME SRC="top.html" NAME=TOP SCROLLING=NO>
    	<FRAMESET COLS="10%,*">
    	<FRAME SRC="left.html" NAME=LEFT SCROLLING=NO">
    	<FRAME SRC="main.html" NAME=MAIN SCROLLING=NO">
    	<NOFRAMES>You have no frames?</NOFRAMES>
    </FRAMESET>
    </html>
    Code:
    <html><head><title>file2.html</title><script language="JavaScript">
    //I want this file to open somewhere else without opening a new browser window
    //These don't work: base target="MAIN" base target="_parent" base target="_parent"
    <!--
    function OpenSub()
    {
    window.parent.location='https://www.cia.gov/';	//just any https site
    //-->
    }
    OpenSub()
    </script>
    </head><body></body></html>

  5. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by hqfx View Post
    What I need is to have file2.html open (when called or clicked) and show up in a different window [...] not open a new window each time...
    I'm sorry, I'm still not understanding your question. This, like your first post, seems to be self-contradictory. Do you want the new file to open in the same window, or a new one?

  6. The Following User Says Thank You to traq For This Useful Post:

    hqfx (02-20-2009)

  7. #5
    Join Date
    Feb 2009
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Thanks traq,
    And sorry for confusion.
    [I know how to use html tags and some javascript as links, but these are files.]

    I will call multiple x.html files - and I want each to open in the _same_ window.
    Without that the browser of course gets cluttered with many windows or tabs(!)
    It could be a new javascript named popup the first time that gets reused for each x.html
    Or it could be (as I tried to describe above) a target frame of my frameset (which is in the same local directory).

  8. #6
    Join Date
    Feb 2009
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    See because its an html FILE rather than a link the browser opens a window even if I do something like:
    Code:
    <html><head><script language="JavaScript" type="text/javascript">
    <!--
    function OpenSub()
    {
    var subWin=window.open('https://www.cia.gov/','subwindow','width=300,height=300');
    subWin.focus();
    //-->
    }
    OpenSub()
    </script></head><body></body></html>
    Maybe I have to autoclose this browser window containing: file:///C:mydirectory/file2.html

  9. #7
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Ok, if I understand you correctly now, you have a window open and when you click on a link, you want a new window. Then, if you click on another link in the original window, you want that to open in the same window as the first link opened, replacing that page. Basically you have two windows/tabs, one that contains the links and another one in which the links are opened, replacing each other. Is that right?

  10. The Following User Says Thank You to Snookerman For This Useful Post:

    hqfx (02-20-2009)

  11. #8
    Join Date
    Feb 2009
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Snookerman View Post
    Ok, if I understand you ... when you click on a link, you want a new window. Is that right?
    No I have a set of html files in a local directory - they are not links.
    I need to call each html file from an external program, and the problem is that since they are files browser opens a new tab/window from that html file, no matter where I target the url to be opened. [And I think IE is a non starter for other reasons related to urls, but Firefox is fine]

  12. #9
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    the code you use to "call" an html file and open it is a link. (Unless I'm really missing something here.)

    When you say "external program," do you mean that you're not opening the html files from an internet browser?

    Are you opening these files all at once, or sequentially as needed?

    And was Snookerman correct about your wanting the first file to open in a new window, then each successive file to open in that same window, replacing the earlier page?

  13. The Following User Says Thank You to traq For This Useful Post:

    hqfx (03-02-2009)

  14. #10
    Join Date
    Feb 2009
    Posts
    6
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    correct - the html files are opened from a non-browser program
    correct - each file opens successively in the same window

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
  •