简体   繁体   中英

Load page in javascript without opening it

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?

You can do this using the XMLHttpRequest object.

This is subject, however, to cross-domain scripting limitations.

Read more about it:

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)
  }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM