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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:49:24+00:00 2026-06-13T15:49:24+00:00

As the title says, I have a few javascript files. There are sections that

  • 0

As the title says, I have a few javascript files. There are sections that call a few websites. I want to be able to store the websites in a different file, this way if the website changes we just need to make one change and not many.

Any suggestions?

I tried doing something like

/**
 * Returns URLs
 */
var URLCONTEXT = "/root-url/context/";
var URLROOT = "/root-url/";

function getContextUrl(){
    return URLCONTEXT;
}

function getRootUrl(){
    return URLROOT;
}

but this doesn’t have a way to communicate with the other JS files =/

  • 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-13T15:49:25+00:00Added an answer on June 13, 2026 at 3:49 pm

    Include your url constants in a js file like

    url-constants.js
    
    var URLCONTEXT = "/root-url/context/";
    var URLROOT = "/root-url/";
    

    and reference this js file first before other js files.

    and you will be able to use url-constants variable in any other js file.

    other.js
    
    function getContextUrl(){
        return URLCONTEXT;
    }
    
    function getRootUrl(){
        return URLROOT;
    }
    

    include these in your page like

    <script language="text/javascript" src="url-constants.js"></script>
    <script language="text/javascript" src="other.js"></script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

as the title says, is there a way I can have a clock that
Like the title says, I have a (faulty) Regex in JavaScript, that should check
I just want what my title says.I have already read all the previous similar
The title says it mostly. If I have an object in Python and want
Ok, so as the title says, I have an HTML page that I fetch
As the title says I have a list of Django objects and I want
As the title says, I have a method that throws a NullReferenceException in my
As the title says.. is there any possible way to have the simplest of
As the title says, I have a mySQL database that has data on it.
As the title says really. I have two columns. I want to put them

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.