[英]Keep a chrome extension popup after close it
我正在開發一個Chrome擴展程序,可以輕松訪問一些文檔,基本上它是一個彈出式網站。
一切正常,但是當我關閉彈出窗口並再次打開它時,它將重新啟動彈出窗口,我想在關閉窗口之前保留用戶所在的位置。
有任何想法嗎?
------------屏幕截圖--------------------
因此,我想做的是當用戶再次打開彈出窗口時,向他顯示他正在觀看的視圖。
setPopup
是您需要識別的基本代碼部分。
if(localStorage.Page && localStorage.Page != document.URL){
//STORE CURRENT PAGE
localStorage.Page = document.URL;
//TRIM STRING
var string = "chrome-extension://"+window.location.host+"/";
String.prototype.ltrim = function() {
return this.replace(string,"");
}
//SETPOPUP OVERWRITES MANIFEST DATA
chrome.browserAction.setPopup({
tabId: null, // Set the new popup for this tab.
popup: localStorage.Page.ltrim() // Open this html file within the popup.
});
}else{
localStorage.Page = document.URL;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.