javascript - Keep Popup Open when Opening a new Page -


i have following code introduce chrome extension.

// detect if first time running var first_run = false; if (!localstorage['ran_before']) {     first_run = true;     localstorage['ran_before'] = '1'; }  // if not, start intro() script if (first_run) intro();  // intro script function intro() {     window.open("intro/index.html", '_blank'); } 

but sadly, when click extension, doesn't open popup.html opens intro page.. needs keep popup.html open , i'm sure there way this. i want open them both @ same time.

what best way this?

while marc guiselin's answer excellent, may useful know how open tab without closing popup.

you open tab in background, way won't close popup.

chrome.tabs.create({   url: chrome.runtime.geturl("intro/index.html"),   active: false }); 

in general, should avoid using window.open in extensions , use chrome.tabs , chrome.windows api instead.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -