Yesod重定向到页面上 [英] Yesod redirect to anchor on page

查看:98
本文介绍了Yesod重定向到页面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用重定向和Yesod的路由系统重定向到 example.com/page#anchor ?如果是这样,怎么样?

Is it possible to redirect to example.com/page#anchor using redirect and Yesod's routing system? If so, how?

推荐答案

您可以使用 getUrlRender URL渲染器,然后将 #anchor 附加到该URL。例如:

You can use getUrlRender to get the URL renderer, and then append #anchor to that. For example:

render <- getUrlRender
redirect $ render myRoute <> "#anchor"

可能值得添加一个便利功能来自动执行此过程。

It might be worth adding a convenience function to automate this process.

这篇关于Yesod重定向到页面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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