javascript - chrome extension get source html not currentPage -


how can source https://google.com when i'm in http://example.com in chrome extension. read: getting source html of current page chrome extension html currentpage only. need html source url. thanks!

  • use xmlhttprequest download whatever server responds when url accessed. on sites minipage script loader later render page in case loaded browser normally.

  • to rendered source or dom tree of arbitrary url you'll have load in tab first. make process less distracting user load in pinned tab:

    chrome.tabs.create({url: "https://google.com", pinned: true}, function(tab) {     .... wait tab load, source }); 

    (the simplest form of waiting doesn't require additional permissions periodic checking of tab.status == "complete" invoked above callback, otherwise use webnavigation.oncompleted example or inject content script run-of-the-mill "domcontentloaded" or "load" event handlers).

  • or load page in iframe sites forbid browser it.


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -