When there are no query parameters present in the input URL, an exception is encountered while obtaining value after esri.urlToObject(url).query method.
上次发布: August 25, 2014ArcGIS API for JavaScript
漏洞 ID 编号
NIM052292
已提交
December 22, 2009
上次修改时间
June 5, 2024
适用范围
ArcGIS API for JavaScript
找到的版本
1.5
编程语言
JavaScript
操作系统
Windows OS
操作系统版本
2003
修正版本
ArcGISJavaScriptAPI 1.6
状态
Fixed
此漏洞已得到修复。 有关详细信息,请参阅“版本修复”和“其他信息”(如果适用)。
解决办法
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); } }