简体   繁体   English

用户登录后如何重定向?

[英]How to redirect once user is logged in?

I have a secure zone log in form. 我有一个安全区域登录表单。 These normally get processed then the user is taken to a specific page that is the landing page for the secure zone. 这些通常会被处理,然后用户被带到特定页面,该页面是安全区域的登录页面。 I would like to change the log in form so that it logs them in the same way, but allows me to redirect them to a different page. 我想更改登录表单,以便以相同的方式记录它们,但允许我将它们重定向到不同的页面。 How can I use javascript to accomplish this? 我怎样才能用javascript来完成这个? The reason for doing this is that I have almost 3000 subscribers to this secure zone and don't want to have to duplicate them for a different secure zone. 这样做的原因是我有近3000个订阅者到这个安全区域,并且不想为不同的安全区域复制它们。 Any help is greatly appreciated. 任何帮助是极大的赞赏。

html form: HTML格式:

<form name="catseczoneform74513" onSubmit="return checkWholeForm74513(this)" method="post" action="https://redlakewalleye.worldsecuresystems.com/ZoneProcess.aspx?ZoneID=12369&amp;Referrer={module_siteUrl,true,true}&amp;OID={module_oid}&amp;OTYPE={module_otype}">
        <div class="form">
        <div class="item">
            <label for="SZUsername">Username</label><br />
            <input class="cat_textbox_small" type="text" name="Username" id="SZUsername" maxlength="255" />
        </div>
        <div class="item">
            <label for="SZPassword">Password</label><br />
            <input class="cat_textbox_small" type="password" name="Password" id="SZPassword" maxlength="255" autocomplete="off" />
        </div>
        <div class="item">
            <input type="checkbox" name="RememberMe" id="RememberMe" /><label for="RememberMe">Remember Me</label>
        </div>
        <div class="item">
            <input class="cat_button" type="submit" value="Log in" />&nbsp;<a href="/_System/SystemPages/PasswordRetrieveRequest">Lost password?</a>
        </div>
        </div>
        <script type="text/javascript" src="/CatalystScripts/ValidationFunctions.js"></script>
        <script type="text/javascript">
            //<![CDATA[
            function checkWholeForm74513(theForm){var why = "";if (theForm.Username) why += isEmpty(theForm.Username.value, "Username");if (theForm.Password) why += isEmpty(theForm.Password.value, "Password");if (why != ""){alert(why);return false;}theForm.submit();return false;}
            //]]>
        </script>
    </form>

To redirect a user to a different location with javascript, use the following: 要使用javascript将用户重定向到其他位置,请使用以下命令:

window.location.href = "http://www.example.com";

As stated here , an alternate method is as follows: 如所陈述在这里 ,另一种方法如下:

window.location.replace("http://stackoverflow.com");

The first emulates the behavior of clicking on a link, the other acts as a HTTP redirect. 第一个模拟点击链接的行为,另一个模拟HTTP重定向。

你可以使用document.location.href = "link";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何检查用户是否登录然后重定向? - How to check if user logged and then redirect? 用户登录后如何动态更新指令? - How to dynamically update directive once user is logged in? 如果用户使用AngularJS登录,如何重定向到仪表板? - How to redirect to dashboard if user is logged in with AngularJS? 如果用户未登录 Firebase,如何重定向 - How to redirect if User Is NOT logged-in in Firebase 用户登录后显示底部导航 - Show BottomNavigation once the user is logged 用户登录后如何通过浏览器记住登录详细信息 - How to remember login details by browser once user is logged in React - 用户登录后如何在导航栏中隐藏注册/登录? - React - How to hide register/login in navbar once a user has logged in? 一旦用户登录系统,如何保护单页应用程序? - How to secure Single Page Application once user Logged in the system? 如何检测用户是否已登录以重定向到特定页面javascript - How to detect if the user is logged in to redirect to a specific page javascript 您如何重定向未使用护照身份验证登录的用户 - how do you redirect a user who is not logged in using passport authentication
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM