获取当前网页地址 [英] Get current webpage URL

查看:24
本文介绍了获取当前网页地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
Javascript 中的请求地址

我在我的网页中使用了 Facebook 插件,如图所示:

I am using a Facebook plugin in my web page, as shown:

<iframe 
   src="http://www.facebook.com/plugins/like.php?href=YOUR_URL"
   scrolling="no" 
   frameborder="0"
   style="border:none; width:120px; height:30px">
</iframe>

如何使用 JavaScript 获取网页的当前 URL?我需要指定当前 URL 而不是 href=YOUR_URL.我怎样才能做到这一点?

How can I get the current URL of the web page, using JavaScript? I need to assign current URL instead of href=YOUR_URL. How can I achieve this?

推荐答案

只是不要输入 href 参数.Facebook 将默认为当前页面.

Just don't put an href parameter. Facebook will default to the current page.

这篇关于获取当前网页地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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