require(["esri/core/urlUtils"], (urlUtils) => { /* code goes here */ });
import * as urlUtils from "@arcgis/core/core/urlUtils.js";
esri/core/urlUtils
Utility methods for working with URLs.
Method Overview
Name | Return Type | Summary | Object |
---|---|---|---|
Adds the given proxy rule to the proxy rules list: | urlUtils | ||
Returns the proxy rule that matches the given URL. | urlUtils | ||
Tests whether a url uses the data protocol. | urlUtils | ||
Tests whether a url uses the https protocol. | urlUtils | ||
Converts the URL arguments to an object representation. | urlUtils |
Method Details
-
addProxyRule
addProxyRule(rule){Number}static
-
Adds the given proxy rule to the proxy rules list:
esriConfig.request.proxyRules
.ParametersSpecificationrule ObjectAn object specifying a URL that should use the proxy. See the object specification table below for the required properties of this object.
ReturnsType Description Number The index of the proxy rule in the esriConfig.request.proxyRules
array.- See also
-
Returns the proxy rule that matches the given URL.
Parameterurl StringThe URL of the resources accessed via proxy.
Returns- See also
-
isDataProtocol
isDataProtocol(url){Boolean}static
Since: ArcGIS Maps SDK for JavaScript 4.32urlUtils since 4.0, isDataProtocol added at 4.32. -
Tests whether a url uses the data protocol.
This will return
true
if the url starts withdata:
.Parameterurl StringThe url to test.
ReturnsType Description Boolean Returns true
if the url uses the data protocol, false otherwise.
-
isHTTPSProtocol
isHTTPSProtocol(url){Boolean}static
Since: ArcGIS Maps SDK for JavaScript 4.32urlUtils since 4.0, isHTTPSProtocol added at 4.32. -
Tests whether a url uses the https protocol.
This will return
true
if the url starts with the https protocol, or if the url is protocol relative and the application is running on https.Parameterurl StringThe url to test.
ReturnsType Description Boolean Returns true
if the url uses the https protocol, false otherwise.
-
Converts the URL arguments to an object representation.
ReturnsType Description Object | null | undefined 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. Examplelet 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"} }