My aim is to enter the url of a website, and from this url, get the css of this website. However, I do not know how to get the absolute url of the css from the website url. I tried to workaround by getting the relative path using Jsoup ( https://jsoup.org/ ) but I did not succeed.
Anyone has an idea on how to get the absolute path of css or any other idea on how I could retrieve it?
There's an example in the documentation: https://jsoup.org/cookbook/extracting-data/working-with-urls
String absHref = link.attr("abs:href"); // "http://jsoup.org/"
If you want this for CSS you could pass the absHref into an URI object an take the hostname and prepend with whatever relative URL is available for the stylesheet(s).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.