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

  • Home
  • SEARCH
  • 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 923997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:16:56+00:00 2026-05-15T19:16:56+00:00

Is there a one-liner I could execute in a javascript console to download and

  • 0

Is there a one-liner I could execute in a javascript console to download and execute a javascript script from a remote source?

I was looking to see if there was a nice way to download this script and use it for experimenting interactively on random pages which may not have say, jQuery loaded.

[edit: I’m aware I could dynamically create a script element but is there a nicer way to do this?]

  • 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-15T19:16:57+00:00Added an answer on May 15, 2026 at 7:16 pm

    I’ve written a little script for that.

    var loadjQuery = function(cb){
       if(typeof(jQuery) == 'undefined'){
         var scr = document.createElement('script');
         scr.setAttribute('type', 'text/javascript');
         scr.setAttribute('src', 'http://code.jquery.com/jquery-latest.js');
    
         if(scr.readyState){
            scr.onreadystatechange = function(){
                if(scr.readyState === 'complete' || scr.readyState === 'loaded'){
                   scr.onreadystatechange = null;
                   if(cb === 'function'){
                      args = [].slice.call(arguments, 1);
                      cb.apply(this, args);
                   }
                }
            };
         }
         else {
            scr.onload = function(){
               if(cb === 'function'){
                  args = [].slice.call(arguments, 1);
                  cb.apply(this, args);
               }
            };
         }
    
         var head = document.getElementsByTagName('head')[0];
         head.insertBefore(scr, head.firstChild);  
       }
    }
    

    This works cross-browser.

    edit

    I’ve updated that script as a function with a callback. Synopsis should be:

    loadjQuery(function(something){
        // execute code after library was loaded & executed
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a one-liner to read all the lines of a file in Python,
Is there a quick one-liner to call datepart in Sql Server and get back
Is there a quick tcpdump one-liner to print out a TCP stream that matches
I'm sure there's some trivial one-liner with perl, ruby, bash whatever that would let
Hey I was just wondering if there is a cool one liner that would
I feel stupid for asking, but there must be a one liner that does
Is there a one-line easy linq expression to just get everything from a simple
I am trying to login to an FTP server from VB script and execute
Is there some method where one could use a try statement to catch an
Is there a way to do this in one line? $x =~ s/^\s+//; $x

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.