clearing hash without reload

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

clearing hash without reload

Daniel Konczyk
Hi

Has anybody figured out how to clear the hash (location.hash)
without page reload?

I've struggled with this the number of times and the best
solution I've found was locations.hash = null
It worked with ie 5.5/6, FF 1.0.*, mozilla 1.6, opera 8.* (but
not with konqueror 3.3.2 and probably Safari? :/ )

When I was doing locations.hash = '' the url was cut out in
Mozilla/FF, so when it was buba.html, doing locations.hash = ''
made it buba.htm so when I was hitting refresh, I was server 404
error..

SO, I was happy with null anyway to this very day. I've switched
to FF 1.5 for development and I found, that locations.hash =
null refreshes the page (and probably cuts the url too hehe)

So, is there any universal way to clear that damn hash?
I just can't wait for IE 7 to come. I will probably have to redo
everything, because they'll 'fix something'.

Thanks,

Dan
_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: clearing hash without reload

David Schontzler
So do you want to get rid of the hash at the end of a URL (i.e.
foo.html#) or a hash and its value (i.e. foo.html#bar)? If you only
really care about the *value* disappearing, you can just do:
  location = "#";

and you'll be good to go. If you really must have the entire hash
gone, setting it to null may be the best solution available.

-d

On 12/11/05, Daniel Konczyk <[hidden email]> wrote:

> Hi
>
> Has anybody figured out how to clear the hash (location.hash)
> without page reload?
>
> I've struggled with this the number of times and the best
> solution I've found was locations.hash = null
> It worked with ie 5.5/6, FF 1.0.*, mozilla 1.6, opera 8.* (but
> not with konqueror 3.3.2 and probably Safari? :/ )
>
> When I was doing locations.hash = '' the url was cut out in
> Mozilla/FF, so when it was buba.html, doing locations.hash = ''
> made it buba.htm so when I was hitting refresh, I was server 404
> error..
>
> SO, I was happy with null anyway to this very day. I've switched
> to FF 1.5 for development and I found, that locations.hash =
> null refreshes the page (and probably cuts the url too hehe)
>
> So, is there any universal way to clear that damn hash?
> I just can't wait for IE 7 to come. I will probably have to redo
> everything, because they'll 'fix something'.
>
> Thanks,
>
> Dan
> _______________________________________________
> Dojo-interest mailing list
> [hidden email]
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: clearing hash without reload

Daniel Konczyk
On 11/12/05 15:49 -0800, David Schontzler wrote:
> So do you want to get rid of the hash at the end of a URL (i.e.
> foo.html#) or a hash and its value (i.e. foo.html#bar)? If you only
> really care about the *value* disappearing, you can just do:
>   location = "#";
>
> and you'll be good to go. If you really must have the entire hash
> gone, setting it to null may be the best solution available.

David, thanks for the reply
I need to get rid of everything, so '#value'

If I set it to null, FF 1.5 goes pretty crazy...
So far it was working good in every browser (well, except
konqueror, which reloads the page whatever you do with the
hash :/ )
Now, FF 1.5 is the exception...Arghh

Dan
_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Re: clearing hash without reload

David Schontzler
On 12/11/05, Daniel Konczyk <[hidden email]> wrote:

> On 11/12/05 15:49 -0800, David Schontzler wrote:
> > So do you want to get rid of the hash at the end of a URL (i.e.
> > foo.html#) or a hash and its value (i.e. foo.html#bar)? If you only
> > really care about the *value* disappearing, you can just do:
> >   location = "#";
> >
> > and you'll be good to go. If you really must have the entire hash
> > gone, setting it to null may be the best solution available.
>
> David, thanks for the reply
> I need to get rid of everything, so '#value'

Is it really that important? Maybe there's a better solution than
trying to clobber the "#".

> If I set it to null, FF 1.5 goes pretty crazy...
> So far it was working good in every browser (well, except
> konqueror, which reloads the page whatever you do with the
> hash :/ )
> Now, FF 1.5 is the exception...Arghh
>
> Dan
> _______________________________________________
> Dojo-interest mailing list
> [hidden email]
> http://dojotoolkit.org/mailman/listinfo/dojo-interest
>
_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: clearing hash without reload

Daniel Konczyk
On 11/12/05 20:58 -0800, David Schontzler wrote:
> On 12/11/05, Daniel Konczyk <[hidden email]> wrote:
> > On 11/12/05 15:49 -0800, David Schontzler wrote:
> > > So do you want to get rid of the hash at the end of a URL (i.e.
> > > foo.html#) or a hash and its value (i.e. foo.html#bar)? If you only
> > > really care about the *value* disappearing, you can just do:
> > >   location = "#";
> > >
> > > and you'll be good to go. If you really must have the entire hash
> > > gone, setting it to null may be the best solution available.

If I set it to null, firefox 1.5 (linux) will reload the page
and what's more interesting, it will try to load a wrong URL.
It actually cuts the last char

So when you have buba.html#xxx and you do location.hash = null
then it tries to reload to buba.htm...
Similar problem is when you do location.hash = '' - this does
not trigger a load event, but it cuts the URL too. When user
click refresh button of the browser, he'll be loaded to buba.htm
too...

> >
> > David, thanks for the reply
> > I need to get rid of everything, so '#value'
>
> Is it really that important? Maybe there's a better solution than
> trying to clobber the "#".

Maybe there is. I need to think about some alternative...

Dan
_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Re: clearing hash without reload

David Schontzler
On 12/16/05, Daniel Konczyk <[hidden email]> wrote:
> > Is it really that important? Maybe there's a better solution than
> > trying to clobber the "#".
>
> Maybe there is. I need to think about some alternative...

You have a use case?
_______________________________________________
Dojo-interest mailing list
[hidden email]
http://dojotoolkit.org/mailman/listinfo/dojo-interest
Loading...