[thelist] JavaScript opener reload (with a twist)

Michael Pemberton mpember at phreaker.net
Sun Sep 16 21:50:12 CDT 2001

Here's what the netscape JS Docs say:

Loads the specified URL over the current history entry.

Syntax replace( URL)

	URL - A string specifying the URL to load.

The replace method loads the specified URL over the current history
entry. After calling the replace method, the user cannot navigate to the
previous URL by using browser’s Back button.

If your program will be run with JavaScript 1.0, you could put the
following line in a SCRIPT tag early in your program. This emulates
replace, which was introduced in JavaScript 1.1:
	if (location.replace == null)
	location.replace = location.assign

The replace method does not create a new entry in the history list. To
create an entry in the history list while loading a URL, use the
History.go method.

Method of Location
Implemented in JavaScript 1.1

--------------- end of blatent cut and paste -------------------

All you will need to do is generate the new URL like so:

	var oldDoc=document.location.toString();
	var newDoc=oldDoc+"#anchor";

I hope this helps.  

Lauri Vain wrote:
> Hello everybody,
> I have two HTML documents:
> The first opens the small second window using JavaScript.
> Now, the second window takes user input and executes a few server side
> operations and needs to be closed after that. It sends the command
> location.reload() to the main window and closes.
> Usually I would do this in the small opened window:
> <.JavaScript>
> opener.document.location.reload();
> self.close();
> <./JavaScript>
> This time, unfortunately, it needs to be done slightly differently. The main
> window should do a reload as usual and then *jump* to a certain point on the
> page (anchor "id_9" or <a name="id_9">).
> Is there a way the small window could tell its opener to reload with #id_9 in
> the end of its usual URL? I hope you see where I'm going... Ideas?
> Thanks in advance!
> Yours,
> Lauri
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !

Michael Pemberton
mpember at phreaker.net
ICQ: 12107010

More information about the thelist mailing list