简体   繁体   English

更改Chrome扩展程序弹出页面

[英]Changing chrome extension popup page

Is it possible to load a different popup page based on some conditions? 是否可以根据某些条件加载其他弹出页面? If there are multiple ways to do so, I need everything I can get on this topic. 如果有多种方法可以实现,那么我需要在该主题上可以获得的所有知识。

You can generate the page on client side using ReactJS or any other framework or stack of libraries. 您可以使用ReactJS或任何其他框架或库堆栈在客户端生成页面。

How to build a Chrome Extension with React JS 如何使用React JS构建Chrome扩展程序

If you want to embed some other page within your popup, then you could use iframe for this purpose. 如果您想在弹出窗口中嵌入其他页面,则可以使用iframe来实现此目的。

Simple sample code to be run on your background page, this could get you started: 在后台页面上运行简单的示例代码,这可以帮助您入门:

if (condition1) {
    chrome.browserAction.setPopup({popup:"popup1.html"});
} else if (condition2) {
    chrome.browserAction.setPopup({popup:"popup2.html"});
} else if (condition3) {
    chrome.browserAction.setPopup({popup:"popup3.html"});
} // etc.

See documentation . 请参阅文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM