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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:43:25+00:00 2026-06-17T12:43:25+00:00

I tried many ways, and can’t figure how to do this. I am loading

  • 0

I tried many ways, and can’t figure how to do this.

I am loading number of external scripts in the header of many html files. Here is an example:

<script type="text/javascript"  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({  tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
</script>

<script type="text/javascript" language="Javascript" 
        src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js">
</script>

<script type="text/javascript" src="http://www.wolfram.com/cdf-player/plugin/v2.1/cdfplugin.js"></script>

What is the best way to avoid having to copy and paste these again and again in each HTML file?

I could not put all of these in one common.js file and include that, since these already have <script> in them. i.e. I can’t do this

<script src="common.js"></script>

Any idea how to do this? may be with jquery? (I know nothing about it). May be this is related? Jquery load() a html file which contains JavaScript

thanks

  • 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-17T12:43:26+00:00Added an answer on June 17, 2026 at 12:43 pm

    You can use the following commands multiple times in your common.js for each source you want to load. Just keep changing the node.src value.

        var node = document.createElement('script');
        node.src = "https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js";
        document.body.appendChild(node);
    

    And you can choose where to add your script in body i.e. document.body.appendChild(node); or head i.e document.head.appendChild(node); of html

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

Sidebar

Related Questions

I've tried many functions already, but I simply can't figure this out. The right
I have tried many ways of executing this but its not happening .. here
I've searched and searched and tried many different ways, but I can't seem to
I tried many ways to solve this problem but none works. suppose I have
I've tried many ways to do this, the only one which seems to partially
As SpriteMethodTest says there are many ways for drawing sprites. Firstly, I tried canvas,
I've tried many variations of this command: idle.py -e filepath , but it simply
I have tried so many ways but failed to logged in purevolume.com programmatically! login
I have tried many ways( all documented procedures)to inject script into a specific page
Really tried to look around, used search. Used Google, tried many ways, but I

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.