带有标头或会话 ID 的 JavaScript 重定向
我有两个网页,我试图在它们之间发送信息。一种是登录页面,它接收用户信息并调用 Web 服务来确定用户是否经过身份验证。确保身份验证后,我想重定向到我的其他网页,并以某种方式告诉用户已登录并已通过身份验证。
我知道 javascript 有 window.location = url
但据我所知,这不会转发身份验证标头或其他任何内容。有没有办法使用身份验证标头进行重定向或以其他方式告诉用户已通过身份验证?
感谢您的任何帮助。
I have two web pages that I am trying to send information between. One is the login page that takes in the users information and calls a web-service to determine if the user is authenticated. Upon ensuring authentication I want to redirect to my other web page with some way of telling that the user has logged in and is authenticated.
I know that javascript has window.location = url
but this does not forward the authentication header or anything else as far as I know. Is there a way to redirect with authentication headers or other way to tell the user is authenticated?
Thanks for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有标准方法可以做到这一点,因为 javascript 是一种客户端语言,但您有一些替代的低安全性解决方案。会话不需要运行客户端语言,也为了更好的安全性,您最好坚持使用 PHP 或其他服务器因为 javascript 很容易被跳过,这可能会给你带来麻烦。
只需将经过身份验证的语言也用于会话和标头功能即可。
希望这有帮助,
问候。
There is not a standard method for doing that since javascript is a client side language but you have some alternative low-security solutions.Sessions are not necessary to function a client side language also for the better security you better stick to PHP or some other server side language.Because javascript can be easily skipped and it might put you in a trouble.
Just use your authenticated language for session and header functions also.
Hope this helped,
Regards.