如何获取当前页面的URL? [英] How to get current page URL?

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

问题描述

我正在分享按钮中的文档在应用程序中添加fb共享按钮。它的工作正常,但我想在Facebook上分享当前页面的URL。例如:

I am adding fb shared button in application using the docs at Share Button. Its working fine, but I want to share the current page's URL in facebook. For example:

<div class="fb-share-button" data-href="https://developers.facebook.com/docs/plugins/" data-type="button"></div>

我想填写我当前的网址 href 部分,我如何实现这个

I want to fill my current URL href section, how can i achieve this

http://localhost:3000/news/view/2

这是我的URL,这里的id每次更改,而不是 developers.facebook.com 如何在这里添加我的URL id。

This is my URL, here id changing each time, instead of developers.facebook.com how can I add my URL id here.

推荐答案

request.original_url 

将返回当前的URL。请参阅链接了解更多信息。

will return current url. refere this link for more info.

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

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