urlUtils

AMD: require(["esri/core/urlUtils"], (urlUtils) => { /* code goes here */ });
ESM: import * as urlUtils from "@arcgis/core/core/urlUtils.js";
Object: esri/core/urlUtils
Since: ArcGIS Maps SDK for JavaScript 4.0

Utility methods for working with URLs.

Method Overview

Name Return Type Summary Object

Adds the given proxy rule to the proxy rules list: esriConfig.request.proxyRules.

urlUtils

Returns the proxy rule that matches the given URL.

urlUtils

Converts the URL arguments to an object representation.

urlUtils

Method Details

addProxyRule

Method
addProxyRule(rule){Number}static

Adds the given proxy rule to the proxy rules list: esriConfig.request.proxyRules.

Parameters
Specification
rule Object

An object specifying a URL that should use the proxy. See the object specification table below for the required properties of this object.

Specification
proxyUrl String

The URL of the proxy.

urlPrefix String

The URL prefix of the resources that should be accessed through the given proxy.

Returns
Type Description
Number The index of the proxy rule in the esriConfig.request.proxyRules array.

getProxyRule

Method
getProxyRule(url){Object}static

Returns the proxy rule that matches the given URL.

Parameter
url String

The URL of the resources accessed via proxy.

Returns
Type Description
Object The proxy rule object as defined in esriConfig.request.proxyRules.

urlToObject

Method
urlToObject(url){Object}static

Converts the URL arguments to an object representation.

Parameter
url String

The input URL.

Returns
Type Description
Object Returns an object representing the URL, its parameters, and parameter values. The specification of the object is the following:
Property Type Description
path String The path of the given URL.
query Object An object whose properties and values are the parameters and parameter values of the given URL.
Example
let myObject = urlUtils.urlToObject("http://www.myworld.com?state_name=Ohio&city_name=Akron");
  // The value of my Object is...
  // { path: "http://www.myworld.com", query: {state_name: "Ohio", city_name: "Akron"} }

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

The developer dashboard has moved

You can no longer sign into this site. Go to your ArcGIS portal or the ArcGIS Location Platform dashboard to perform management tasks.

Your ArcGIS portal

Create, manage, and access API keys and OAuth 2.0 developer credentials, hosted layers, and data services.

Your ArcGIS Location Platform dashboard

Manage billing, monitor service usage, and access additional resources.

Learn more about these changes in the What's new in Esri Developers June 2024 blog post.

Close