By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,110 Members | 1,568 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,110 IT Pros & Developers. It's quick & easy.

modifying the content of the address bar without triggering apostback

P: n/a
Hello,

I would like to modify the content of the location bar (address bar)
using JavaScript. Suppose I am at
http://localhost/WebTests/TestEvent.aspx
The followig line:
window.location = "aaa";
changes the content of the address bar to:
http://localhost/WebTests/aaa

which is fine except that it then goes ahead and causes a full
postback to the server. How can I change the content of the location
bar without causing a postback?

I can also use
location.hash="aaa";
this does not trigger a postback but changes the content of the
address bar to:
http://localhost/WebTests#aaa

and i want
http://localhost/WebTests/aaa

Thanks!
Apr 5 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
VK
On Apr 5, 9:55 am, nimad <nim...@gmail.comwrote:
Hello,

I would like to modify the content of the location bar (address bar)
using JavaScript. Suppose I am athttp://localhost/WebTests/TestEvent.aspx
The followig line:
window.location = "aaa";
changes the content of the address bar to:http://localhost/WebTests/aaa

which is fine except that it then goes ahead and causes a full
postback to the server. How can I change the content of the location
bar without causing a postback?

I can also use
location.hash="aaa";
this does not trigger a postback but changes the content of the
address bar to:http://localhost/WebTests#aaa

and i wanthttp://localhost/WebTests/aaa

Thanks!
So like user comes to some malicious site but the script shows
http://www.bankofamerica.com in the address bar so the user would have
full confidence to type in his online account info? I am not saying
that you are doing something like this: I am just explaining why no
one browser will allow to do anything like this for obvious security
reasons. Moreover, in IE7 and higher address bar is now enforced for
all script-generated windows. That is another frequent question here:
"how to remove address bar in window.open?" and the same answer: you
cannot do it for the security reasons.

Apr 5 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.