Description
(Added at v3.8)
Utility methods for working with URLs.
When coding legacy (non-AMD) style, there is no need to require the module. All methods and properties are available in the namespace. For example,
esri.addProxyRule()
.
Samples
Search for
samples that use this class.
Methods
Method Details
Adds the given proxy rule to the proxy rules list: esri.config.defaults.io.proxyRules
Parameters:
<Object > rule |
Required |
The rule argument should have the following properties.
- proxyUrl - URL for the proxy.
- urlPrefix - URL prefix for resources that need to be accessed through the given proxy.
|
Sample: // All requests to route.arcgis.com will use the proxy defined in this object.
esri.addProxyRule({
urlPrefix: "route.arcgis.com",
proxyUrl: "/proxy.ashx"
});
Returns the proxy rule that matches the given url.
Parameters:
<String > url |
Required |
The URL of the resources accessed via proxy. |
Converts the URL arguments to an object representation. The object format is
{path: <String>, query:{key:<Object>}}
Parameters:
<String > url |
Required |
The input URL. |
Sample: var myObject = esri.urlToObject("http://www.myworld.com?state_name=Ohio&city_name=Akron");
Returns:
{ path: "http://www.myworld.com", query: {state_name: "Ohio", city_name: "Akron"} }
If there are no query parameters the return value for query will be null:
{path:"http://www.myworld.com",query:null}
The following snippet shows how to check for null or undefined values.
var myObject = esri.urlToObject("http://www.myworld.com");
if(myObject.query){
var query = myObject.query;
}