promisefeni / reallysimplehistory

Automatically exported from code.google.com/p/reallysimplehistory
Other
0 stars 0 forks source link

window.dhtmlHistory.getCurrentLocation returns undefined in Safari 3 (Mac & Win) #29

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I'm currently using RSH 0.6RC1.
After initializing dhtmlhistory and waiting for the page onload event, I
try to access the history string using
window.dhtmlHistory.getCurrentLocation().  This returns undefined in Safari
3.0.4, both on Mac and Windows.  I haven't tried other versions.

This may be related to Task 10, but I created a new issue since this is
happening on the Mac.  RSH is on the first page, as described in task 10.

I can use the location.hash string, but from the RSH source code, it seems
that getCurrentLocation() is the preferred approach.

Original issue reported on code.google.com by imad.yam...@gmail.com on 15 Nov 2007 at 6:30

GoogleCodeExporter commented 8 years ago
Actually, getCurrentLocation is used internally by RSH and shouldn't be accessed
directly by your application. I should probably make it private. To react to 
history
changes, you should use .addListener() to register your own history listener. 
With
each history change, your listener will then be fired and passed two 
parameters: the
current key (the part of the url after the #) and the value stored in RSH's 
history
stack.

To see this in action, dig through the source code of rshTestPage.html. 
Additional
usage examples will be included with the final release of RSH 0.6.

Original comment by bdpathfi...@gmail.com on 16 Nov 2007 at 1:25

GoogleCodeExporter commented 8 years ago
I'm going to leave this issue open as a reminder to take a careful look at which
methods of RSH are truly public and mark all the others private. Now that the 
code
forks and uses a separate mechanism for safari, getCurrentLocation should be 
private
the same way the Safari methods are - it's not safe to call from application 
code.

Original comment by bdpathfi...@gmail.com on 16 Nov 2007 at 1:27

GoogleCodeExporter commented 8 years ago
I bumped into this one too.  I found getCurrentHash() a suitable replacement 
for what I was doing, assuming that 
one remains public.

Original comment by tlia...@gmail.com on 19 Nov 2007 at 6:36

GoogleCodeExporter commented 8 years ago
getCurrentHash is not going to remain public; it's an internal method and 
should have
been private all along.

These methods are all helper mechanisms for the main public methods of 
historyStorage
and dhtmlHistory. Can anyone explain to me why they'd want to call them 
directly? Are
you just trying to perform some application logic related to the startup of your
application? If so, couldn't you just write your own function to examine 
window.location?

If people really want a convenience method, I could probably debug the problem 
with
getCurrentLocation and make sure it works as expected in Safari. Though I 
wonder if
somebody could post their actual code so I can see how they're trying to use it 
and
debug in Safari.

Original comment by bdpathfi...@gmail.com on 20 Nov 2007 at 10:39

GoogleCodeExporter commented 8 years ago
I was looking for the "official" way to get the current history string from the
framework, in case reading location.hash was not the preferred approach.  The 
code
for getCurrentLocation() made me think it was the way to go, in particular 
because it
dealt with Safari differently.
I don't think there's a need for a convenience method.

Original comment by imad.yam...@gmail.com on 21 Nov 2007 at 3:30