用Firefox扩展显示网页当前的URL [英] Display Webpage current URL with Firefox extension
问题描述
为了标题的目的,我写了下面的代码,而不是让真正的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 : } 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屋!window.addEventListener("change", function() { myExtension_with_change.init(); }, false);
var myExtension_with_change = {
init: function() {
var url = window.location.href;
alert(url);
}