Log in

View Full Version : open htm FILES without multiple browser windows/tabs



hqfx
02-20-2009, 02:02 AM
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!

Snookerman
02-20-2009, 07:22 AM
I'm not really sure I understand your question, but you could try these:

<base target="_top">
or

<base target="_parent">

Good luck!

hqfx
02-20-2009, 02:42 PM
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.



<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>




<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>

traq
02-20-2009, 03:28 PM
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?

hqfx
02-20-2009, 04:11 PM
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).

hqfx
02-20-2009, 04:23 PM
See because its an html FILE rather than a link the browser opens a window even if I do something like:


<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

Snookerman
02-20-2009, 04:28 PM
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?

hqfx
02-20-2009, 05:33 PM
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]

traq
02-25-2009, 03:56 PM
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?

hqfx
03-09-2009, 02:22 PM
correct - the html files are opened from a non-browser program
correct - each file opens successively in the same window