在Ruby on Rails中的控制器中获取URL的锚点部分 [英] Get anchor part of URL in controller in Ruby on Rails

查看:72
本文介绍了在Ruby on Rails中的控制器中获取URL的锚点部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在控制器中获取URL的锚点部分?

Is there a way to get the anchor part of a URL in a controller?

示例:如果我输入 http://www.foo.com/bar#anchor123 我可以在控制器中获取字符串anchor123吗?

Example: if I type http://www.foo.com/bar#anchor123 can I get the string anchor123 in my controller?

推荐答案

您无法在Rails中执行此操作,因为锚点未发送到服务器.参见 mikeduncan.com/?s = named +锚点

You can't do that in Rails, because the anchor is not sent to the server. See mikeduncan.com/?s=named+anchors

这篇关于在Ruby on Rails中的控制器中获取URL的锚点部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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