书签如何访问Firefox扩展(反之亦然) [英] How can a bookmarklet access a Firefox extension (or vice versa)

查看:199
本文介绍了书签如何访问Firefox扩展(反之亦然)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写了一个Firefox扩展,可以在输入一个特定的URL的时候捕获并执行一些操作。我的主要应用程序启动与此URL的Firefox。该网址包含敏感信息,所以我不希望它被存储在历史记录中。



我担心没有安装扩展程序的情况。如果没有安装Firefox,并且使用敏感的URL启动Firefox,它将被存储在历史记录中,我无能为力。所以我的想法是使用书签。

我会用javascript:window.location.href ='please installthisplugin.html'; sensitiveinfo ='blahblah'来启动Firefox。



如果未安装扩展程序,它们将被重定向到一个页面,告诉它们安装它,敏感信息将不会被存储在历史记录中。如果安装了扩展名 ,它将获取sensitiveinfo变量中的信息并执行它。



我的问题是,小书签可以调用方法在扩展中传递敏感信息(如果是这样,如何),或者当在书签中调用javascript时扩展名可以捕获?

小书签和Firefox扩展如何沟通?

解决这种情况的另一种方法是为我的主要应用程序启动Firefox并使用套接字与扩展进行通信,但是我不愿意这样做,因为多年来遇到过多问题,用户使用疯狂的防火墙阻止套接字通讯。如果可能,我想尽一切办法来解决问题。

解决方案

据我所知,bookmarklets永远不能访问chrome文件扩展名)。


I have written a Firefox extension that catches when a particular URL is entered and does some stuff. My main app launches Firefox with this URL. The URL contains sensitive information so I don't want it being stored in the history.

I'm concerned about the case where the extension is not installed. If its not installed and Firefox gets launched with the sensitive URL, it will get stored in history and there's nothing I can do about it. So my idea is to use a bookmarklet.

I will launch Firefox with "javascript:window.location.href='pleaseinstallthisplugin.html'; sensitiveinfo='blahblah'".

If the extension is not installed they will get redirected to a page that tells them to install it and the sensitive info won't get stored in the history. If the extension IS installed it will grab the information in the sensitiveinfo variable and do its thing.

My question is, can the bookmarklet call a method in the extension to pass the sensitive info (and if so, how) or can the extension catch when javascript is being called in the bookmarklet?

How can a bookmarklet and Firefox extension communicate?

p.s. The alternative means of getting around this situation would be for my main app to launch Firefox and communicate with the extension using sockets but I am loath to do that because I've run into too many issues over the years with users with crazy firewalls blocking socket communication. I'd like to do everything without sockets if possible.

解决方案

As far as I know, bookmarklets can never access chrome files (extensions).

这篇关于书签如何访问Firefox扩展(反之亦然)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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