I\'m trying to extract the page title of an external site by using a url.
You know how \"document.title\" returns the title of the page the JS is running on? I was w
I think you're looking for $.ajax, since this is a cross domain request, which can be done from js using a call to YQL:
http://usejquery.com/posts/the-jquery-cross-domain-ajax-guide
EDIT
Okay I finally got a working example: http://jsfiddle.net/zXVcy/
EDIT
Here is how to fix the script tag problem in xdomain.js:
if (_success) {
var dataString = "";
try {
dataString = data.results[0].replace(/<script[^>]+?\/>|<script(.|\s)*?\/script>/gi, '');
}
catch {
dataString = data.results[0];
}
// Fake XHR callback.
_success.call(this, {
responseText: dataString
}, 'success');
}
}
That is not possible through Javascript. You must use a server script to achieve this.