How to Make Requests with Chrome Developer Tools

·

1 min read

How to Make Requests

  1. Open the developer tools on the web page (for Chrome, press F12).

  2. Go to the console.

  3. Enter the JavaScript function, for example: goMenu('1018','admin');.

  4. Press Enter to execute the function.

Example

JavaScript Code

function user_auth_check(needLevel, userLevel){

    if(needLevel == userLevel){
        return true;
    }else{
        return false;
    }
}

function goMenu(code, userLevel){
    switch (code){
        case '1018':
            if(user_auth_check('admin',userLevel)){
                location.href="./fire_nuclear_Attack.php";
                break;
            }else{
                alert('You do not have permission.');
                break;
            }
        case '1129':
            location.href="./logout.php";
            break;
        default:
            alert('This menu does not exist.');
    }
}

Webpage Button Code

<a class="btn btn-lg btn-danger" href="#" role="button" onclick="goMenu('1018','')">Fire</a>