Is there a way to distinguish between a local path and a reference to another server using JavaScript?
Given the list of URLs below, how can I identify which ones point to files on the local file system versus those leading to example.com?
var paths = [
'foo/bar.css',
'/bar/foo.css',
'//cdn.example.com/monkey.css',
'https://example.com/banana.css'
];
I have reviewed the url
npm package, but it does not parse the third URL correctly to extract the host information.
My goal is to gather CSS details from a webpage as well as linked stylesheets, using a script that only has access to the page's URL. I need to determine if subsequent requests should be sent to the original host or another like example.com.