简体   繁体   English

每当地址栏中的URL更改Firefox JPM时如何获得通知

[英]How to get notified whenever the URL in the address bar changes Firefox JPM

Is it possible to detect whether an URL changes, while developing Firefox addons using the new SDK/JPM? 使用新的SDK / JPM开发Firefox插件时,是否可以检测URL是否更改?

It's not exactly hashchange what I want to detect, but any changes to the URL, like ajax request changing search terms or things like that. 这并不是我想检测的hashchange,而是URL的任何更改,例如ajax请求更改搜索词或类似内容。

Is it a way to do it? 有办法吗? Thanks. 谢谢。

I came up with a solution which includes using a combination of MutationObserver and "old location value checking". 我想出了一个解决方案,其中包括结合使用MutationObserver和“旧位置值检查”。

Basically I implemented a value check on location.href but using a MutationObserver to detect changes in the DOM, instead of using an interval which would kill the performance and waste some precious milliseconds. 基本上,我在location.href上实现了一个值检查,但是使用MutationObserver来检测DOM中的更改,而不是使用一个间隔来杀死性能并浪费一些宝贵的毫秒。

Thanks for the contributions. 感谢您的贡献。 Hope this helps anyone. 希望这对任何人有帮助。

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

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