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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:33:56+00:00 2026-05-30T16:33:56+00:00

I have a question! I’m not sure if this is possible, but… I have

  • 0

I have a question! I’m not sure if this is possible, but…

I have on a page a javascript include file. At the top of the file is a comment, looks something along the lines of this:

/*
  Local site config.js 
  Last updated: 2012.01.04
*/

What I would like to be able to do is within another javascript file (this file gets loaded after the first file), somehow get that date. So my question is, are comments somehow stored within the DOM, or is there some other way to access the contents of this file in a way that I could just use regex to scrape for it, etc..?

Basically I have a global file that depends on local files for some config options, and there are a ton of sites that have their own local config file. I would like to be able to grab that date from the local .js file within the global file. Both local and global .js files are hosted on the same domain, but the sites that include the .js files may or may not be on the same domain as the .js files.

I know the right answer is to update all the local .js files to put that date in a .js variable, and as a long term solution, I certainly intend on doing that. But as a short term solution the only thing I can change right now is the global .js file. If it can’t be done then it can’t be done, but I wanted to explore my options and so far I can’t think of any way to get that date…Soo… anybody have any ideas?

  • 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-30T16:33:57+00:00Added an answer on May 30, 2026 at 4:33 pm

    So my question is, are comments somehow stored within the DOM…

    Nope.

    …or is there some other way to access the contents of this file in a way that I could just use regex to scrape for it, etc..?

    Not without loading it a second time via ajax, and that would be limited by the SOP. E.g, you can do an ajax GET for the file, which will give you its text, and then apply a regular expression to find the bit after “Last updated:”. But the .js file would have to be on the same origin as the HTML document you’re doing this in (see the link for why).

    Ideally, as you said, you want to modify the first file so that it saves that date in a variable where you can access it. (This would probably end up being a global variable, which is less than ideal, unless you already have some other global you can stick it on as a property.)

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

Sidebar

Related Questions

I have question with this same title here but now as I'll present in
This could be a duplicate question, but I have no idea what search terms
i have question about finding maximum x or y-value in text file. This is
I have question, maybe it's not critical in programming, but to me it's very
I have question. I have some app on facebook and getting this error Fatal
I have question regarding polymorphism about its assignment statement, for Example this is The
I have a question regarding inheritance in Java. If I have this base class
ok i have question, i made this code to play axmediaplayer base on item
I have question here, i design multiview application using view base template. Page 1
Have question on PropertyPlaceholderConfigurer. If properties file is changed, will spring loads it dynamically

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.