Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Safari window.location.href

0 views
Skip to first unread message

Jeff Paffett

unread,
Dec 29, 2005, 5:59:23 AM12/29/05
to
I'm writing a file manager application using Ajax techniques and the
client wants to be able to bookmark file searches. I send the search
request to a remote server using a XMLHttpRequest and then write the
search string to a # URL, either using window.location.href or
window.location.hash. This works fine with no problems in IE and Firefox
and works OK in Safari, except the browser goes into a permanent page
loading state as soon as I write the # URL.

Any ideas on how to cancel this state?

RobG

unread,
Dec 29, 2005, 6:35:26 AM12/29/05
to

Can you provide a code snippet that shows the behaviour?


--
Rob

Jeff Paffett

unread,
Dec 29, 2005, 7:12:19 AM12/29/05
to
This shows the behaviour:

<head>
<title>Untitled</title>
<meta name="generator" content="BBEdit 8.2" />
<script type="text/javascript">

function foo() {

window.location.hash = 'test';

}

</script>
</head>
<body>

<a href="#" onClick="foo();">Click here</a>

</body>

RobG

unread,
Dec 29, 2005, 7:50:53 AM12/29/05
to

That appears to do nothing in Safari 1.0.3, location.hash is changed,
but then the link is followed so that "http://...#" is shown in the
address bar. Maybe you should use:

<a href="#" onClick="foo(); return false;">Click here</a>


Which changes what is displayed in the # part of the URL in the
address bar.

The permanent page load doesn't happen for me at all, which version of
Safari are you using?


--
Rob

Jeff Paffett

unread,
Dec 29, 2005, 8:23:17 AM12/29/05
to
I'm on v 2.0.2.

According to this: http://www.s-seven.net/safari_bug.html#h_value6 your
version won't show the problem.

0 new messages