用Firefox扩展显示网页当前的URL [英] Display Webpage current URL with Firefox extension

查看:173
本文介绍了用Firefox扩展显示网页当前的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了标题的目的,我写了下面的代码,而不是让真正的URL得到以前的URL(例如,如果我在Google上,并在搜索字段中键入car并键入输入我得到http://www.google.fr而不是从搜索网址)。



code:

  window.addEventListener(change,function(){myExtension_with_change.init();},false); 

var myExtension_with_change = {
init:function(){
var url = window.location.href;
alert(url);

$ / code>

}

解决方案

在另一篇文章中 https://stackoverflow.com/users/785541/wladimir-palant 给了一个完美的答案(通过Firefox扩展,以Javascript动态获取网页的URL)。

I've written the following code for the purpose of the title of the post but instead of having the real URL I get the previous URL (e.g. If I'm on Google and type "car" in the search field and type "Enter" I get "http://www.google.fr" and not the URL from the search).

code :

window.addEventListener("change", function() { myExtension_with_change.init(); }, false);

var myExtension_with_change = {
   init: function() {
       var url = window.location.href;
       alert(url);
}

}

解决方案

In another post https://stackoverflow.com/users/785541/wladimir-palant gave a perfect answer ( Get URL of a webpage dynamically with Javascript on a Firefox extension ) .

这篇关于用Firefox扩展显示网页当前的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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