如何使用JavaScript打开我的扩展程序的弹出窗口? [英] How can I open my extension's pop-up with JavaScript?

查看:134
本文介绍了如何使用JavaScript打开我的扩展程序的弹出窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写一个JavaScript函数来打开我的扩展,就像点击扩展图标时一样。我知道如何在新选项卡中打开我的扩展程序:

I am trying to write a JavaScript function that will open my extension like when the extension icon is clicked. I know how to open my extension in a new tab:

var url = "chrome-extension://kelodmiboakdjlbcdfoceeiafckgojel/login.html";
window.open(url);

但是我想在浏览器的右上角打开一个弹出窗口,扩展图标被点击。

But I want to open a pop-up in the upper right corner of the browser, like when the extension icon is clicked.

推荐答案

Chromium开发团队明确表示他们不会启用此功能。请参阅功能请求:以编程方式打开扩展程序弹出式窗口

The Chromium dev team has explicitly said they will not enable this functionality. See Feature request: open extension popup bubble programmatically :


浏览器和页面动作弹出窗口的理念是它们必须由用户操作触发。我们的建议是使用新的HTML通知功能...

The philosophy for browser and page action popups is that they must be triggered by user action. Our suggestion is to use the new html notifications feature...

桌面通知可以在程序中使用,以向用户显示一个非常类似于弹出窗口的小型HTML页面。这不是一个完美的替代品,但它可能提供您需要的功能类型。

Desktop notifications can be used progammatically to present the user with a small HTML page much like your popup. It's not a perfect substitution, but it might provide the type of functionality you need.

这篇关于如何使用JavaScript打开我的扩展程序的弹出窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆