url()
Use this method to check a URL to see if it is malicious.
Only the domain portion of the URL is checked. The path and query string are stripped before sending the request to the ChainPatrol API to preserve privacy and prevent leaking sensitive information.
Example
Parameters
The URL to check. This can be a full URL or a domain. The URL will be parsed to extract only the domain for checking.
Ex. https://google.com
or google.com
Return Value
The return value is a promise that resolves with an object containing the result of the check.
Success
If the check was successful, the object will contain the following properties:
This property will be true
if the check was successful.
The url
property is the URL that was checked.
The status
property indicates whether the URL is allowed or blocked.
The redirectUrl
property specifies where to redirect the user when the
detector detects a threat. This property will only be present if the
status
property is set to BLOCKED
.
By default, the detector will return the ChainPatrol warning page URL,
but you can override this by specifying your own redirectUrl
in when
instantiating the ThreatDetector
.
Failure
However, if the check was unsuccessful, the object will contain the following:
This property will be false
if the check was unsuccessful.
The url
property is the URL that was checked.
The error
property will contain a human-readable error message.
Was this page helpful?