首页 \ 问答 \ Microsoft Edge popup扩展如何获取后台页面?(Microsoft Edge popup extension how to get backgroundpage?)

Microsoft Edge popup扩展如何获取后台页面?(Microsoft Edge popup extension how to get backgroundpage?)

我正在尝试在Microsoft Edge上使用我的Chrome扩展程序来调整它,但我无法构建弹出窗口,因为在我的弹出窗口的脚本中,某些变量似乎不存在:

var bg = chrome.extension.getBackgroundPage();

这行不起作用,它应该访问内容脚本的数据。 我发现有些人说必须使用browser.extension.getBackgroundPage()替换它,但它不起作用。

我该怎么替换这条线?


I am trying to use my Chrome extension on Microsoft Edge to adapt it, but I can't build the popup because in the script of my popup, some variables seem to not exist:

var bg = chrome.extension.getBackgroundPage();

This line isn't working, it supposed to access data of content scripts. I've found some guys saying browser.extension.getBackgroundPage() must be used to replace it, but it doesn't work to.

By what should I replace this line?

更新时间:2023-02-04 10:02

最满意答案

  1. 由于Microsoft Edge使用browser.*命名空间,因此您应该使用browser.extension.getBackgroundPage()

  2. 有关调试后台脚本和内容脚本的信息,请参阅调试扩展以获取更多详细信

  3. 对于调试弹出脚本,似乎没有可见的条目。 一种解决方法是通过键入弹出网址在Microsoft Edge中手动打开该页面,类似于ms-browser-extension://[Extension_Id]/html/popup.html


  1. Since Microsoft Edge uses browser.* namespace, you should use browser.extension.getBackgroundPage() instead.

  2. For debugging background script and content script, see Debugging extensions for more details

  3. For debugging popup scripts, it seems there is no visible entry. One workaround would be manually opening that page in Microsoft Edge via typing the popup url, something like ms-browser-extension://[Extension_Id]/html/popup.html

相关问答

更多

相关文章

更多

最新问答

更多
  • 在csproj中使用appdata环境变量(Use appdata environment variable in csproj)
  • 从背景返回后,Skobbler Map崩溃(Skobbler Map crashes after returning from background)
  • 如何保持对绑定服务的轮询?(How to keep polling a bound service?)
  • ASP.NET单选按钮jQuery处理(ASP.NET radio button jQuery handling)
  • Linux上的FORTRAN图形库(FORTRAN graphic library on Linux)
  • 我们如何根据索引更新dynamodb表(不基于primary has和range key)(how can we update dynamodb table based on index(not based on primary has and range key))
  • 功能包装避免重复(wrap of functions avoid duplicating)
  • Android BroadcastReceiver和Activity.onPause()(Android BroadcastReceiver and Activity.onPause())
  • 无法使用phonegap 2.4在Android上播放录音(unable to play audio recordings on android using phonegap 2.4)
  • VS2015 + Resharper:不要使用C#6(VS2015 + Resharper: Don't use C#6)
  • 大学电脑四级对初学者来说要多久能过
  • 特殊字符删除?(Special characters remove?)
  • Android视频教程现在网上的都比较零散呢?有些太坑爹了,感觉老师就是在想当然的讲
  • 计算同一个表中不同行之间的差异[重复](Calculate delta's between different rows in same table [duplicate])
  • Javaweb开发,技术路线是什么?该怎么写?
  • JavaScript只在php代码中执行一次(JavaScript only executes once inside php code)
  • 不兼容的字符编码:ASCII-8BIT和UTF-8(incompatible character encodings: ASCII-8BIT and UTF-8)
  • Clojure(加载文件)给出错误(Clojure (load-file) gives an error)
  • 为具有瞬态scala依赖性的spring-xd项目优化gradle(Optimize gradle for spring-xd project with transient scala dependency)
  • 如何才能在Alpha测试模式下发布我的应用程序?(How can I publish my app in Alpha test mode only?)
  • “没有为此目标安装系统映像”Xamarin AVD Manager(“No system images installed for this target” Xamarin AVD Manager)
  • maven中的Scalatest:JUnit结果(Scalatest in maven: JUnit results)
  • 使用android SDK将文件直接上传到存储桶中的文件夹(Upload a file directly to a folder in bucket using android SDK)
  • 是否应将plists导入CoreData?(Should plists be imported to CoreData?)
  • java.lang.reflect.InvocationTargetException JavaFX TableView(java.lang.reflect.InvocationTargetException JavaFX TableView)
  • 根据唯一列值动态创建多个子集(Dynamically create multiple subsets based on unique column values)
  • 使用CSS可以使HTML锚标签不可点击/可链接吗?(Is it possible to make an HTML anchor tag not clickable/linkable using CSS?)
  • 嵌套的模板可能性(Nested template possibilities)
  • 任何方式在iOS7 +上以编程方式打开蓝牙(Any way to turn on bluetooth programmatically on iOS7+)
  • 如何为给定的SQL查询编写JPA查询(How I can write JPA query for given SQL query)