[英]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.