relative links

Posted on 2005-04-11
Last Modified: 2010-03-31

I am trying to extract links from webpages. I need a solution to convert the relative links to absolute links so that they can also be followed.

Any code is appreciated. I am doing this in java.

Question by:sumantedla
    LVL 4

    Expert Comment

    Hi sumantedla,

    Here you go:

    Best regards,
    Danny Ebbers

    Author Comment

    But how can i do that for links in webpages. When I extract the urls in a webpage, some of them are relative and someof them are absolute. I want to make the relative links absolute so that they can also be visited by connecting to that page.
    LVL 4

    Accepted Solution


    Converting and URL from relative to absolute , you need to know the BASEURL, if you know the base url
    you could use the URL object

    you can do this in various ways:
    here it will show you some samples:

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
    Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
    Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
    Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now