Skip to content Skip to sidebar Skip to footer

Get Websites Title

I am trying to retrieve the title of a URL for a link. For example get the title of this: will be g

Solution 1:

Solution 2:

Solution 3:

For security reasons, you cannot read content from a different website using Javascript, even just to read the title.

You could write a server-side proxy that requests a remote page and finds its <title> tag using an HTML parser.

However, you shouldn't do this at the client side; it will waste time and resources. If you really want to do this, do it once on the server as a pre-processing step when you create a new page.

Solution 4:

Unless the URL's href is on the domain of the current document, using JavaScript to try to get the title of the target document would require cross-domain scripting which is not generally allowed (using traditional methods) by browsers. Unless you're real fancy with proxies (not entirely sure how that is done), you'll need a server-side language to load the document first.

Post a Comment for "Get Websites Title"