尽管单击浏览器中打开的页面,但仍使面板持久存在 [英] Making a panel persist despite click on page opened in browser

查看:100
本文介绍了尽管单击浏览器中打开的页面,但仍使面板持久存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要实现

  1. 将面板固定到小部件
  2. 使其持久化
  3. 它只会在单击小部件时出现或消失
  4. 或者可以通过单击某个按钮使其消失 我要实现这一目标,是因为我的插件完全位于面板中 此处是插件.
  1. Anchor a panel to a widget
  2. make it persist
  3. It will only appear or disappear when widget is clicked
  4. or It may be made to disappear by clicking some button on it I want to achieve this because my addon is entirely residing in a panel Here is the addon.

推荐答案

好,我对此进行了更多介绍,我想对以下几件事表示歉意:

Ok, I looked at this a bit more, and I'd like to apologize for a couple of things:

    由于跨域安全问题,
  1. iframe无法正常工作.那是一个死胡同.
  2. 我花了很长时间才回到您的身边,我一直在度假,而我们所住的地方每天每间客房仅允许30分钟的wifi上网.
  1. iframe won't work due to cross-domain security issues. That was a dead end.
  2. I took waaay too long to get back to you, I've been on holiday and the place we were staying at only allowed 30 minutes of wifi per day, per room.

一种解决方法是直接从数据文件夹中加载html,将其传递到内容脚本中,然后将其注入页面中.像这样:

One way to approach this is to load your html directly from the data folder, pass it into the content script and inject it into the page. Something like this:

https://builder.addons.mozilla.org/addon/1043886/latest /

一些可用性准则:

  1. 用户应该能够轻松,明显地从页面中删除注入的内容.如果需要保留所注入内容的状态,则需要在删除DOM节点之前对其进行存储.
  2. 注入仅应在用户执行操作(例如通过单击小部件)时发生.这至少应该是默认设置.
  3. 应该照常非常小心地处理从注入的内容发送回main.js附加代码的所有数据.不要信任来自网络的数据!

这篇关于尽管单击浏览器中打开的页面,但仍使面板持久存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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