I tried using window.open() with '_blank' and then window.blur() in chrome, but the web-page does not hide itself from the user. All I want to do is open a child web-page from its parent (with same origin) while hiding the child, scrape some of the html from the child's body, then close the child web-page. I know I could also do this with an iframe, but I am building a chrome extension that needs to interact with the child web-page and won't do so with an iframe, unless there's a way I can do that? Here is my working code I have so far:
var links = document.getElementsByClassName("link");
var num = links.length;
for (var i = 0; i < num; i++) {
var win = window.open(links[i].href, "_blank");
win.blur();
}
var links = document.getElementsByClassName("link");
var num = links.length;
for (var i = 0; i < num; i++) {
var win = window.open(links[i].href,"_blank")
win.close();
}
with modifying your method window will be closed immediately but the user will able to detect that(means any window is opened and close sudden) (tested on chrome)
var links = document.getElementsByClassName("link");
var num = links.length;
for (var i = 0; i < num; i++) {
var win = window.open(links[i].href,"_blank",'toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,left=10000, top=10000, width=10, height=10, visible=none', '')
win.close();
}
with this method, the user will not able to see if there is any window open or not.
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.