
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
is-absolute-url
Advanced tools
Check if a URL is absolute
npm install is-absolute-url
import isAbsoluteUrl from 'is-absolute-url';
isAbsoluteUrl('https://sindresorhus.com/foo/bar');
//=> true
isAbsoluteUrl('//sindresorhus.com');
//=> false
isAbsoluteUrl('foo/bar');
//=> false
isAbsoluteUrl('javascript:alert(1)');
//=> false
isAbsoluteUrl('javascript:alert(1)', {httpOnly: false});
//=> true
Type: string
The URL to check.
Type: object
Type: boolean
Default: true
Only allow HTTP(S) protocols.
When set to false, any valid absolute URL will be accepted, including potentially unsafe protocols like javascript:, ftp:, ws:, etc.
Warning: Setting
httpOnlytofalsecan pose security risks as it will returntruefor URLs with protocols likejavascript:,vbscript:,data:,ftp:,ws:, etc. Only set this tofalseif you understand the implications and have appropriate safeguards in place.
See is-relative-url for the inverse.
The 'is-url' package checks if a string is a URL. It is similar to 'is-absolute-url' but does not specifically focus on absolute URLs, making it broader in scope but less specialized for checking absolute URLs.
The 'valid-url' package provides methods to validate URLs and check if they are absolute. It offers more comprehensive URL validation features compared to 'is-absolute-url', which strictly checks for absolute URLs.
FAQs
Check if a URL is absolute
The npm package is-absolute-url receives a total of 6,819,155 weekly downloads. As such, is-absolute-url popularity was classified as popular.
We found that is-absolute-url demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.