Forum Moderators: open

Message Too Old, No Replies

Script Tag

question of script tag with defer attribute

         

flashfan

1:55 pm on Jun 3, 2004 (gmt 0)

10+ Year Member



From MS website, I found the following and couldn't understand:


<script id="top2" language="javascript" type="text/javascript" defer="true"></script>
<script language="javascript" type="text/javascript" src="shared/js/survey.js?6/3/2004 6:33:35 AM"></script>

flashfan

1:56 pm on Jun 3, 2004 (gmt 0)

10+ Year Member



The first doesn't have src, what will be deferred?

The seond has timestamp appended, what's this for?

Rambo Tribble

3:17 pm on Jun 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The defer attribute basically tells the browser that scripts won't be writting any of the page's content and that it can be rendered without interruption.

The time stamp is part of the data being delivered to a server script. Note the "?" in the URL.

flashfan

3:37 pm on Jun 3, 2004 (gmt 0)

10+ Year Member



The time stamp is part of the data being delivered to a server script. Note the "?" in the URL.

Will the server deliver different js based upon the timestamp? What will the timestamp be used for?

Rambo Tribble

4:17 pm on Jun 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Impossible to say without knowing the contents of the server script.

dcrombie

7:59 pm on Jun 3, 2004 (gmt 0)



I add a timestamp (not in that format) when testing - it prevents the linked file from being cached as the reference changes every time the page is reloaded.

eg. <IMG src="/images/foo.gif?<?= time(); ?>">

;)

flashfan

6:04 pm on Jun 4, 2004 (gmt 0)

10+ Year Member



Cool! I was using version# and reload to avoid caching. //blush