JS bug: location.hash, .href

David Faure david at mandrakesoft.com
Tue May 7 15:31:02 BST 2002


On Tuesday 07 May 2002 15:46, Harri Porten wrote:
> On Tue, 7 May 2002, Will Stephenson wrote:
> 
> > I was using a form (http://www.gradschools.ac.uk/apply/apply_apply.html), some 
> > JS in it moves you around, but has the unpleasant side effect of blanking the 
> > form of all input so far.
> > 
> > I looked around and found it was because they assign to location.href in order 
> > to move the user around the form, I've produced a testcase which demonstrates 
> > this, but more importantly, using location.hash (which I think is the proper 
> > way) to move to a named anchor also clears the form.
> 
> The JS implementation for the location object treats all href changes the
> same: they result in a redirection to the new URL. The case of just
> changing the hash has the same result as e.g. changing the host. Namely a
> reload of the page.
> 
> khtml developers: is there a way to jump to a hash inside of document via
> the KHTMLPart API ?

The code in KHTMLPart::openURL is supposed to detect that current URL
and the URL to open are the same (minus the hash part) and to jump to
that location without reloading the page. This is _supposed_ to work already,
it sounds like a bug if it doesn't ;)
I suggest to debug openURL, maybe the URLs don't match due to a trailing
slash, or worse, to a redirection....

-- 
David FAURE, david at mandrakesoft.com, faure at kde.org
http://people.mandrakesoft.com/~david/
Contributing to: http://www.konqueror.org/, http://www.koffice.org/
KDE, Making The Future of Computing Available Today





More information about the kfm-devel mailing list