P
Phil Powell
Code:
if (document.location.href.indexOf('?') >= 0) document.location.href
= document.location.href.substring(0,
document.location.href.indexOf('?'));
if (document.location.href.indexOf('#') >= 0) {
document.location.href = document.location.href.substring(0,
document.location.href.indexOf('#')) + '?' + newUrl;
} else {
document.location.href = document.location.href + '?' + newUrl;
}
I thought this would simply and always remove the query string and the
"#" from a URL, however, it does not. Using alert() proves the query
string and the "#" is still embedded within the URL, furthermore, it
tacks on the query string on top of itself time and time again each
time this snippet is done upon a user click.
All I want to do is do "document.location.href" and chop off the query
string and "#" before it redirects in Javascript.
Thanx
Phil