laptop and a wrench

Bug

When there are no query parameters present in the input URL, an exception is encountered while obtaining value after esri.urlToObject(url).query method.

Last Published: August 25, 2014 ArcGIS API for JavaScript
Bug ID Number NIM052292
SubmittedDecember 22, 2009
Last ModifiedJune 5, 2024
Applies toArcGIS API for JavaScript
Version found1.5
Program languageJavaScript
Operating SystemWindows OS
Operating System Version2003
Version FixedArcGISJavaScriptAPI 1.6
StatusFixed

Workaround

You can avoid the errors by adding some type checking to the code. I've modified the snippet below to check if query is null and foo is undefined before trying to work with them. var myObject = esri.urlToObject(window.location.href); if(myObject.query){ var query = myObject.query alert('query is ' + query); if(query.foo){ var foo = query.foo; alert('value of foo parameter is ' + foo); } }

Steps to Reproduce

Bug ID: NIM052292

Software:

  • ArcGIS API for JavaScript

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options