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 992469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:16:23+00:00 2026-05-16T06:16:23+00:00

Is it possible to write a Greasemonkey script to trigger the Ctrl + A

  • 0

Is it possible to write a Greasemonkey script to trigger the Ctrl+A (select all) action in Firefox? (after a new page is loaded if the script is enabled?)

Help me at any level possible for you.

Update:

"Firefox has got addons to speed read or read aloud selected text. I just wish to automate the part where text is to be selected."

  • 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-05-16T06:16:23+00:00Added an answer on May 16, 2026 at 6:16 am
    var r = document.createRange()
    r.selectNode(document.body)
    window.getSelection().addRange(r)
    

    I tried creating a new Greasemonkey script, typing the above code (which I grabbed and edited from this page), and loading a page.

    It did select all the text, but for some pages, it becomes unselected immediately. For example, Google’s homepage, because the page focuses the search field.


    Update by BA:

    This didn’t work on Google because it’s fighting native scripts. But, by re-running the code at onload and again after, we can preserve the selection.

    Also, if the native script sets focus to an input or textarea, we must fight that.

    So, a Greasemonkey script that incorporates all these ideas, and seems to work is:

    //--- Save this as "SelectWholePage.user.js" and install with Greasemonkey.
    //
    // ==UserScript==
    // @name            Select a whole page
    // @namespace       google.com
    // @description     Selects a whole page (equivalent to 'Ctrl-A').
    // @include         http://www.google.com/*
    // ==/UserScript==
    //
    
    /*--- Run the main function 3 times (when DOM ready, at load and just after
        load) because page javascript will often reset the focus and selection.
    */
    LocalMain ();
    window.addEventListener
    (
        "load",
        function(evt)
        {
            LocalMain ();
            window.setTimeout (LocalMain, 222);
        },
        false
    );
    
    function LocalMain ()
    {
        var WholePage       = document.createRange ();
        WholePage.selectNode (document.body);
    
        window.getSelection ().addRange (WholePage);
    
        var aInputs         = document.getElementsByTagName ("input");
    
        for (var J = aInputs.length-1;  J>0;  J--)
            aInputs[J].blur ();
    
        document.body.focus ();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it posible to write greasemonkey script or add-on for firefox to automaticly add
I was sitting here wondering if it's possible to write a greasemonkey script that
Is it possible to write this query in codeigniter active records? $Main_Nav_Query = mysql_query(SELECT
Is it possible to write a System.Web.UI.Page and stored in an assembly? And how
I'm trying to write a Greasemonkey script that works with Gmail. the script is
Is it possible to write a htaccess file which will take a URL /some-new-name
Is it possible to write a script to see which processes/programs are sending/receiving data
Is it possible to write a code for for example close event of all
is it possible to write tooltip for html.RouteLink ? my link: <%= Html.RouteLink(<, new
Is it possible to write JPQL query like following: select count(*) > 0 from

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.