Javascript redirect with headers or session id

时光怂恿深爱的人放手 提交于 2019-12-19 05:00:05

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/6388066/javascript-redirect-with-headers-or-session-id

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!