How can I autologin into a website with IE?

2019-08-02 04:06发布

问题:

I use below source code in my script.

I worked fine with Crome Browser.

but didn't work with Internet Explorer.

How can I do?

somebody help me please.

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script language="JavaScript">
        <!--
        function login() {
            document.form1.action="http://website.com/login/login.asp";
            document.form1.submit();
        }
        //-->
    </script>
</head>
<body onload="login()">
<form method=post name="form1" id="form1">
    <input type="hidden" name="ID_Text" value="abcd">
    <input type="hidden" name="PW_Text" value="abcd">
</form>
</body>
</html>

回答1:

I am pulling the answer out of your question for future visitors.

<!DOCTYPE html>
    <head>
    </head>
    <body>
        <script type="text/javascript">
            BoardURL="http://WEBSITE.COM";
            UserName="abcd";
            PassWord="abcd";
            document.write('<form name="autoLogin" action="'+BoardURL+'/login/login.asp" method="post"><input type="hidden" name="ID_TEXT" value="'+UserName+'"><input type="hidden" name="PW_TEXT" value="'+PassWord+'">');
            document.forms[0].submit();
        </script>
    </body>
</html>