Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 546
  • Last Modified:

window.location=url is not working properly in Mozilla


 This is the code snippet that  i am using as part of my program.
It is navigating to the new url correctly in InternetExplorer, but it is not working properly in  Mozilla(i.e it is navigating to the home page in case of mozilla.)

This is th e version of mozilla that i'm using .
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

window.location = "/used-cars/search_holding.html?searchStatus=true&cmbMake=" + tmakeid + "&cmbModel=" + tmodelid +"&makeName=" + tmakename + "&modelName=" + tmodelname + "&cmbMinPrice=1&cmbMaxPrice=1000001&txtPostcode=" + savedpostcode +"&cmbDistanceinMiles=200";

wishing the solution..
Thanks in advance.

  • 2
1 Solution
try this

window.location.href = "/used-cars/search_holding.html?searchStatus=true&cmbMake=" + tmakeid + "&cmbModel=" + tmodelid +"&makeName=" + tmakename + "&modelName=" + tmodelname + "&cmbMinPrice=1&cmbMaxPrice=1000001&txtPostcode=" + savedpostcode +"&cmbDistanceinMiles=200";

Michel PlungjanIT ExpertCommented:
Setting the location and setting the location.href is the same unless something funny has happened in FF

I suspect illegal chars in the url.

1. look in the javascript console

2. escape any field that may have spaces or other illegal chars in it:

loc = "/used-cars/search_holding.html?searchStatus=true"+
"&cmbMake=" + escape(tmakeid) +
"&cmbModel=" + escape(tmodelid) +
"&makeName=" + escape(tmakename) +
"&modelName=" + escape(tmodelname) +
"&txtPostcode=" + escape(savedpostcode) +
alert(loc); // remove when you have tested this

Michel PlungjanIT ExpertCommented:
MAy I know why I get a "B" ???

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now