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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:57:49+00:00 2026-05-19T12:57:49+00:00

[SOLVED] I use to build pages normally without javascript and only then to add

  • 0

[SOLVED]

I use to build pages normally without javascript and only then to add javascipt features. This way, I can set all divs with tools that require javascript with display:none and then in the first line on javascript to turn it visible:

<script type="text/javascript">
    $(document).ready(function(){
        $('#jsdivs').show();
    });
</script>

Doing so I get out of the way of people who for any reason have their browsers javascript disabled.

Following this spirit, I’d like to find a way to not load any javascript by default and then, if javascript is enabled have instructions to load the javascript files.

Right now I am loading JQuery like this (for cache reasons, many people may already have this cached):

<script src="http://code.jquery.com/jquery-1.4.4.js"></script>

And another file with all the other javascript minimized. All in the end, just before the HTML body tag.

I saw many opinions here and here but none that help me with this. At first, I’d like to know if that’s a good way of getting this done. Thanks a lot.

UPDATE:

  • @Lèse majesté indicated me an old discussion saying that browsers do not load javascript files when it is disabled. As I didn’t think the information was enough conclusive, I made some tests disabling javascript in Firefox via the plugin “Web Developer” and YSlow (another FF plugin for Firebug) keeps on showing all javascript information, not mentioning that “Live Headers” (another fantastic FF plugin that shows the headers in realtime) also showed that a _utmc cookie (by the Google Analytics script) was present in the request.

  • @Marcel Korpel made a very good (though apparentely snob) comment, which opened the way for a real solution. he said that Google Analytics uses a “method to dynamically include ga.js. The closing tag (and immediately opening tag) is needed to let the browser update the DOM tree and actually load and execute the added script.”

  • With the information on his indication I could come up with this PHP code (I had to put the PHP code in Pastie.org because Stackoverflow was messing with it):

    http://pastie.org/1487432

That prints:

<script language="javascript" type="text/javascript">
    document.write('\<script src\="js\/minified\.js" type\="text\/javascript"\>\<\/script\>');
</script>

This time YSlow and Live Headers say nothing about any javascript file.

  • I have just found out this: http://code.google.com/speed/page-speed/docs/rtt.html#AvoidDocumentWrite
  • 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-19T12:57:50+00:00Added an answer on May 19, 2026 at 12:57 pm

    Most browsers don’t download linked .js files if JavaScript is disabled. See this question:

    Does a browser download JS files if the user has JS disabled?

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

Sidebar

Related Questions

I'll to explain this right: I'm in an environment where I can't use python
I use this Javascript code to mark threads as favourite: function fave(tid){ xmlhttp =
it seems that I just solved my problem why I couldn't use the ASP.NET
I've actually solved this, but I'm posting it for posterity. I ran into a
I've just solved another *I-though-I-was-using-this-version-of-a-library-but-apparently-my-app-server-has-already-loaded-an-older-version-of-this-library-*issue (sigh). Does anybody know a good way to verify
Edit: I have solved this by myself. See my answer below I have set
Is there a way to get struts 2 (using tiles) to build the whole
If I have a choice to use recursion or memoization to solve a problem
SOLVED: Nevermind, the links were visited, and the border definition was missing for visited
Update: Solved, with code I got it working, see my answer below for the

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.