Closed Thread Icon

Topic awaiting preservation: self.location not working Pages that link to <a href="https://ozoneasylum.com/backlink?for=8194" title="Pages that link to Topic awaiting preservation: self.location not working" rel="nofollow" >Topic awaiting preservation: self.location not working\

 
Author Thread
viol
Maniac (V) Inmate

From: Charles River
Insane since: May 2002

posted posted 05-31-2002 02:22

In some part of my code, I use:

self.location = self.location

and, using this instruction, I have a reload of the current page.
But I've just found out that if the address has a bookmark, as
http://www.mydomain.com/htmlpage.htm#bookmark

that instruction does nothing. No reload.
Does anyone know why? Any workaround?
Thanks.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 05-31-2002 03:21

yeah the location in "self.location" is not actually a single property but a whole other object. Most browsers allow you to shorthand this but apparently if it has a choice it gives back the self.location.search string instead of the self.location.href property.

Try self.location = self.location.href;

see if that works.





.:[ The Tao of Steve ]:.
Be Desireless
Be Excellent
Be Gone
...................................

viol
Maniac (V) Inmate

From: Charles River
Insane since: May 2002

posted posted 05-31-2002 08:27

It didn't work.
I'll try to take the #bookmark part out of the full address and then make something like self.location=AddressWithoutBookmark instruction...
Thanks anyway.

viol
Maniac (V) Inmate

From: Charles River
Insane since: May 2002

posted posted 05-31-2002 09:10

I'm using this now:

self.location= (window.location.href.lastIndexOf ("#") == -1)? self.location : window.location.href.substring(0,window.location.href.lastIndexOf("#"));

It works fine in IE6.0. It doesn't work fine in Netscape 6.x.
I don't dare to test it in Opera.
But it's okay.

DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: Stockholm, Sweden
Insane since: Mar 1994

posted posted 05-31-2002 11:38

Hmm, I always use something more like self.location.href="url I want to go to"; - never do I use just self.location all by itself, I always thought it needed the 'href' part, on both sides of the equation. It's been working in all browsers for me for years now.

My "kill the frames script", for example...

if (parent.frames[1]){ top.location.href = self.location.href; }

Your pal, -doc-

viol
Maniac (V) Inmate

From: Charles River
Insane since: May 2002

posted posted 05-31-2002 16:09

I've just tried:
self.location.href=self.location.href;
and it didn't work for the bookmarked addresses, as well. It doesn't reload the page (tested only in IE6.0).

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 05-31-2002 20:08

Have you tried using history.go(0); to realod the page...


viol
Maniac (V) Inmate

From: Charles River
Insane since: May 2002

posted posted 05-31-2002 21:58

Hi mr.maX.
It not only worked fine but also it keeps the #bookmark information, when reloading. My instruction (using indexOf and then substring) does not keep this information (of course), so, if the user is at a bookmark, when the page reloads, he's back to the top of the page. Using your tip, after reloading, he's back at the same point where he were before.
But, and always it seems there is a "but", as it is the case of my instruction, the bookmarked addresses don't work (do not reload) on Netscape 6.0. Ony non-bookmarked addresses work fine with your tip. It works fine only in IE (6.0). Again, I don't dare dealing with Opera. I also don't test in older versions of IE and Netscape (due to limitation of resources, not because I don't like them).
I'm going to use your tip. Thanks.
P.S. - I'm using this "reload" in a rather complex situation (at least to my level of knowledge). I'm using it when I change styles on-the-fly. The user chooses a style (actually, it's more a color scheme than a style) clicking a menu and when he clicks, I have to reload the page so to read the new .css and .js files. I didn't try to make it real on-the-fly (without automatic reload) because since I use an external menu system (not developed by me), and this menu system has its own color configuration file (a .js file), I found no other way but to reload the page.
You can see one of my pages here: http://www.viol.net/mohaa/making_map.htm
Go to the "Others" top menu option, then "Change Style" sub-menu option. There are four colors available, so far. And I use cookies to save the user's choice. The Reset option deletes the cookie so the pages are loaded with their default colors. Also, the pages have many thumbnails of pictures that once clicked will open a popup window with a bigger version of that picture. All the pages share the same javascript file to open this popup window, it's a dinamic generated popup window. The changing in style affects also the colors of this popup window. I've been struggling myself for all of this stuff for more than a month but now I think I have all I want working okay. I don't care if Netscape users are not going to see all a IE user sees, but I test for Netscape to be sure the page is at least good.
BTW, I'm about to introduce a new color scheme for my pages, called "Tomato Black" and it is heavily based on the colors of Asylum, this very site. It's tomato letters on pure black background.

« BackwardsOnwards »

Show Forum Drop Down Menu