Django的。如何重定向到具有片段标识符的URL [英] Django. How to redirect to url with fragment identifier

查看:134
本文介绍了Django的。如何重定向到具有片段标识符的URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如在POST或GET请求后的某些情况下,我想将用户不仅重定向到特定页面,而且重定向到页面的特定部分。什么会更好:在Django中实现(重建重定向网址?)或在javascript中实现?

解决方案

在JS中做如果您正在重定向到其他页面,只需将 #whatever 添加到重定向网址,直接转到锚点。


For example in some cases after POST or GET request I want to redirect user not only to specific page, but to a specific part of page. What would be better: implement this in Django(reconstruct redirect url?) or implement this in javascript?

解决方案

Why would you want to do it in JS? If you're redirecting to a different page already, just add #whatever to the redirect URL to go direct to the anchor.

这篇关于Django的。如何重定向到具有片段标识符的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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