0

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?

1 Answer 1

2

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).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.