Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8151961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:34:03+00:00 2026-06-06T15:34:03+00:00

Fortunately, I know the script works. The problems comes about that $(‘input[value=Log Out]’).click(); Logout

  • 0

Fortunately, I know the script works. The problems comes about that $('input[value="Log Out"]').click(); Logout is too slow and gets overridden by the window redirect. How can I add an additional time out or what would the community suggest to make this process less volatile?

unsafeWindow.likeMe = likeMe;
function likeMe() 
    {   


        input = document.getElementsByTagName("input");
        for(i = 0; i < input.length; i++) 
            {
                myID = input[i].getAttribute("data-profileid");
                if(myID != null && myID.indexOf("342584172457437") >= 0)
                input[i].click();

            }   
            setTimeout(function() {

            $('input[value="Log Out"]').click();
                window.location.href = "https://www.facebook.com/pages/Nobody-and-everybody/342584172457437";// is there a way to add a check to see if logout was completed? if not, how would I add just another setTimeout();?

            }, 5000);

    }


$(window).load(function(){

    var isCtrl = false;
    document.onkeyup=function(e) {
        if(e.which == 17) isCtrl=false;
    }
    document.onkeydown=function(e){
        if(e.which == 17) isCtrl=true;
        if(e.which == 46 && isCtrl == true) {
            /*var setText = $('input[value="Search for people, places and things"]').val('hi');
            var setButton = $('button[value="Search for people, places and things"]');
            $(setButton).click();*/
            likeMe()

            return false;
        }

    }

Creating a project using arduino, processing, javascript/jquery, greasemonkey and facebook.
Art installation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:34:05+00:00Added an answer on June 6, 2026 at 3:34 pm

    The problem is that the logout loads a new page, so that if you wait for it, the redirect will never fire (because the page — that the code was running in — is gone)1.

    So, that means that the script has to track login and desired-redirect state between pages. One way to do that is with GM_setValue().

    To illustrate, here is a complete script that shows how to logout and then redirect.
    In this case, it adds a button to the top-right corner of Facebook pages. When pressed, the button (1) Logs you out, (2) Waits for the logout to finish, (3) Redirects to a new page.

    // ==UserScript==
    // @name      _Logout and Redirect
    // @include   http://www.facebook.com/*
    // @require   http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
    // ==/UserScript==
    
    //--- Are we on a log-in page and has a redirect been requested?
    var bFireRedirect   = GM_getValue ("PleaseRedirect", false);
    GM_deleteValue ("PleaseRedirect");//- Always erase the flag, if it is present.
    
    if (bFireRedirect  &&  $("#login_form #loginbutton").length) {
        //--- We've just come from our auto-logout.  Redirect.
        window.location = "http://dogs.icanhascheezburger.com/"
    }
    
    
    //--- We only get this far if no redirect occurred.
    $("body").append (
        '<button id="gmLogOutAndRedirectBtn">Logout and redirect</button>'
    );
    
    $("#gmLogOutAndRedirectBtn").click ( function () {
        GM_setValue ("PleaseRedirect", true);
    
        $('input[value="Log Out"]').click ();
    } );
    
    GM_addStyle ( (<><![CDATA[
        #gmLogOutAndRedirectBtn {
            margin:                 1 ex;
            position:               fixed;
            top:                    0;
            right:                  0;
            z-index:                888;
        }
    ]]></>).toString () );
    


    1 Newfangled pages — where the logout triggers just a partial AJAX content change — don’t have this problem. But as that is not the case here, it is for another time/question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Fortunately, I know how to fetch data from the database, That's not a problem.
I have a view that loads external HTML into an iframe. I don't know
In DOS batch files, the method of achieving certain things is somewhat obfuscated. Fortunately,
I am using DevExpress OrgChart component that is still maintained but not developed since
So I wrote a Python script which does some simple stuff. It was originally
I know this is a very basic question - but I did not face
BACKGROUND: When you have a page that includes an HTML form, and you refresh/reload
I have a lot of code in a big project that has two general
I accidentally erase files. Fortunately, I have added those to index. Please tell me
My system is having trouble building the boost libraries. I understand that most boost

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.