当前位置:网站首页>chrome extension: how to make the dialog be on the right side of the current window?
chrome extension: how to make the dialog be on the right side of the current window?
2022-07-30 20:33:00 【music】
chrome扩展:How can I make the dialog be on the right side of the current window?
本文介绍了chrome扩展: How to make the extension dialog be located on the right side of the current window.
chrome.action.onClicked.addListener(async function(tab){
var windows = await chrome.windows.getAll({
populate: true, windowTypes: ["popup"]}) || []
// My processing here is that only one dialog box can be displayed,Each time it is judged whether there is an existing dialog box,If there is, take the last dialog to give focus
if(windows.length > 0){
var lastFoucsedWindow = await chrome.windows.getLastFocused({
populate: true, windowTypes: ["popup"]
})
if(!lastFoucsedWindow.focused){
chrome.windows.update(lastFoucsedWindow.id, {
focused: true});
}
}else{
chrome.windows.getCurrent(function(w) {
// w The parameter contains information about the browser window,如 高度、宽度 ...
chrome.windows.create({
tabId: tab.id,url: "popup.html", type: "popup", width:340,height:610,top: 80,left: (w.width - 450)});
});
}
})
边栏推荐
猜你喜欢
随机推荐
Office365无法打开word文档怎么办?Office365无法打开word文档的解决方法
Flink_CDC搭建及简单使用
PR视频剪辑软件教程
To the operation of the int variable assignment is atom?
7、MySQL Workbench 导出导入数据库
HarmonyOS Notes ------------- (3)
mysqldump导出提示:mysqldump [Warning] Using a password on the command line interface can be insecure
flowable工作流所有业务概念
无法正常访问服务器
MYSQL JDBC图书管理系统
bebel系列- 插件开发
Oblique document scanning and character recognition (opencv, coordinate transformation analysis)
推荐系统-排序层:排序层架构【用户、物品特征处理步骤】
2.网络资源访问工具:requests
WPS表格怎么自动1234排下去?wps表格怎么自动生成序号?
vlookup函数匹配不出来的原因及解决方法
Recommendation system: evaluation index [offline evaluation index: RMSE (root mean square error), AUC, precision, recall, F1] [online evaluation: A/B test] [generally required response time <0.5s]
HMS Core Discovery第16期回顾|与虎墩一起,玩转AI新“声”态
MYSQL 唯一约束
TensorFlow2: Overview









