Flying Sagittarius Posted August 13, 2008 Share Posted August 13, 2008 I try to keep as much PHP code as possible at the top, before the <html> tag. Can I do the same with Javascripts? Link to comment https://forums.phpfreaks.com/topic/119426-ok-to-add-javascript-before-tags/ Share on other sites More sharing options...
haku Posted August 13, 2008 Share Posted August 13, 2008 No. Or at least, not validly. It may work, but it may also cause you problems in some browsers. It either has to be between the head tags, or between the body tags. Link to comment https://forums.phpfreaks.com/topic/119426-ok-to-add-javascript-before-tags/#findComment-615256 Share on other sites More sharing options...
RichardRotterdam Posted August 13, 2008 Share Posted August 13, 2008 most definitly not your browser will never see a bit a php code since its processed on the server your javascript will be visible for the browser to read and this must always be either in the head or body section Link to comment https://forums.phpfreaks.com/topic/119426-ok-to-add-javascript-before-tags/#findComment-615295 Share on other sites More sharing options...
Flying Sagittarius Posted August 13, 2008 Author Share Posted August 13, 2008 Ok, thanks. Link to comment https://forums.phpfreaks.com/topic/119426-ok-to-add-javascript-before-tags/#findComment-615462 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.