Discover the web using JavaScript and perform actions

Hope someone can help me here. I use the daily login page that my ISP leads to the system and launches the Internet on my machine. It leaves several times between the connection and I am redirected to the login page. When you click the "Login" button, the Internet starts again.

My question is. Can I automatically detect if the Internet is disconnected and use a script that automatically logs me in.

The login button on the redirected page is as follows:

<input type="submit" name="Submit" id="btnSubmit" value="Login" onclick="return checking();" />
+3
source share
1 answer

DSL / . , , 2Wire.

. Greasemonkey script, , , .

, IP- , Pastebin.com. .

Script:

// ==UserScript==
// @name            Generic Auto Relogin
// @namespace       GenericLocal
// @description     Just removes a login annoyance.  WARNING:  This compromises security!
// @include         *
// @require         http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js
// ==/UserScript==


$(document).ready(Greasemonkey_main);


/*--- WARNING!  Username and password!!!
*/
var sGbl_Username       = 'For demonstration purposes only!';
var sGbl_Password       = 'Hopefully you know that this is a bad idea';


function Greasemonkey_main ()
{
    //--- Is this a login screen? ---
    var zLoginForm      = $("input#btnSubmit");
    if (zLoginForm  &&  zLoginForm.length)
    {
        //--- Set username and password. ---
        $("input#username").attr ('value', sGbl_Username);
        $("input#password").attr ('value', sGbl_Password);

        //--- Submit the login form.
        $("input#btnSubmit")[0].click (); //-- Click submit button.
}
+1

Source: https://habr.com/ru/post/1773463/


All Articles