Reputation: 2373
I'd like to load the contents of a page in javascript without actually opening it. I want to use it so I can load a page and scan some of its elements to see if it should actually be opened in a new window/tab before doing the opening itself.
How can I do that?
Upvotes: 0
Views: 6257
Reputation: 2739
You can do this using the XMLHttpRequest
object.
This is subject, however, to cross-domain scripting limitations.
Read more about it:
Upvotes: 2
Reputation: 17444
Load it in an Ajax call.
With jQuery:
$.ajax({
url: 'http://your_page_url',
success: function( data ) {
// process data (which is actually your page contents)
}
});
Upvotes: 0