Where to include script files

I have separated the various page components in another php file. In the navigation php file, I have objects that I want to use in javascript. where should i put javascript <script ...>so that it loads normally? right now i put it in a completely separate header.php file? but i don't think javascript selects objects from nav.php i hope i make sense;)

+3
source share
5 answers

The standard suggestion is that you should put all your SCRIPT links before your closing BODY tag at the bottom of the document. This simplifies network connections:

http://developer.yahoo.com/performance/rules.html

+1

, PHP , , HTML javascript HTML , javascript.

javascript javascript , , jquery document.ready.

+1

, script ?

http://developer.yahoo.com/performance/rules.html

, , , . HTTP/1.1 , . , , . script .

. , , script document.write , . . .

, , . DEFER , script document.write , . , Firefox DEFER. Internet Explorer script , , . a script , . -.

0

, , ( ), , .

.

0

Source: https://habr.com/ru/post/1730481/


All Articles