javascript - Alternative method to include JS files -


This question is a follow-up question.

If some browsers download JS files, even if user JS is disabled, can it be understood to include JS files to JS files to ensure that the user is unnecessary to JS Not been forced to download form?

For example:

  function inc (filename) {var body = document.getElementsByTagName ('body'). Item (0); Script = document.createElement ('script'); Script.src = filename; Script.type = 'text / javascript'; Body.appendChild (script); }  

I got the code above.

Is there a downside of this code? I have not tested it correctly so far, to make sure that it works properly, but it is very easy.

I am trying to leave more than one HTTP request, which is the download footprint of the forced code for users who do not want to explicitly don

In addition, how will this work if the user initially enabled JSR after loading the site?

Is this also the case? Is this something to be concerned about?

I am returning to this question:

Is that the case too? Is this something to be concerned about?

No, it is not) The percentage of users who deactivate Javascript should be a minority (in most cases), it is not really worth it all users To mess up to save some HTTP requests (which should be cached) For some, tag. >

Also, in the last question, in the initial test, 3/4 browsers do not download it already, so in reality it is only for Chrome ( and possibly IE

Update: I have tested in IE8 now, it does not any included downloads, if JavaScript is disabled, Time is not setup to test any other versions, but it is less in IE8 Less is less than


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -