TYPO3: get a javascript included by "headerData" to load before one included by "includeJS"

noviolence picture noviolence · Aug 23, 2010 · Viewed 28.2k times · Source

I'm loading JQuery into my TYPO3 page by :

page.headerData.10.value = <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

and I'm including my javascript like this :

page.includeJS {
  file20 = fileadmin/templates/myjq.js
} 

Point is, i need the JQuery to be loaded first. but TYPO3 puts it after my script. How do i get it swapped?

Thanks

Answer

DerSchreiner picture DerSchreiner · Feb 20, 2011

you don't want to include JQuery that way; Use

page.includeJSlibs.jquery.external = 1
page.includeJSlibs.jquery = //ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js

instead.

http://typo3.org/documentation/document-library/core-documentation/doc_core_tsref/4.3.2/view/1/6/

Edit Using a URL without a specific protocol (http or https) makes sure the inclusion works on both SSL and non-SSL-sites.