Take the 2-minute tour ×

I'm trying to redirect to a relative url, like this

setTimeout("window.location.pathname = '/help/fusion/index.php#3'", 500);

But the # seems to cause a problem when being passed to the window.location.pathname. The error is

'The requested URL /help/fusion/index.php#3 was not found on this server.'

but the url that the browser actually displays is localhost/help/fusion/index.php%233#1. Anybody know how to avoid this?

share|improve this question
#3 is the fragment identifier and is normally the value that you get when accessing location.hash. I.e. it is a different part of the URL, it is not part of the path. Because of that it is encoded automatically when you are trying to set it as part of the path (# becomes %23). –  Felix Kling Jan 28 '13 at 21:54
add comment

1 Answer

up vote 2 down vote accepted

You can use the window.location to redirect in javascript and pass a function to he setTimeOut function. Try this:

setTimeout(function() { window.location = '/help/fusion/index.php#3'; }, 500);
share|improve this answer
fantastic, thanks. I was under the impression that I could only use the url formatted in such a way with location.pathname –  ejfrancis Jan 28 '13 at 22:05
add comment

Your Answer


