faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 9 people (67%) answered Yes
Recently 3 of 5 people (60%) answered Yes

Entry

I understand that I cant change the URL in the location bar. Anyone knows if you can at least change the search property?

Apr 4th, 2008 21:06
ha mo, Iván Rivera, Jos vanderhave,


Of course you can set the search property by assigning a value to
location.search.
However, since any change to a location property will result in a
reload, you have to be careful. Simply issuing
  location.search='foo';
in your script will cause your page to reload forever! Just check for
the value of the search property before (re)writing it:
  if (location.search!='?foo') location.search='foo';
Hope this is useful.
Iván
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com