The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
[Solved]CSS & JavaScript via function
Hello guys am working with google <script async> the whole situatios
so, google below refers to the following:: :source: HTML Code:
<script> var node = document.createElement('script'); node.type = 'text/javascript'; node.async = true; node.src = 'example.js'; // Now insert the node into the DOM, perhaps using insertBefore() </script> HTML Code:
<script type="text/javascript"> var fcb_js = document.createElement('script'); fcb_js.type = 'text/javascript'; fcb_js.async = true; fcb_js.src = '/clientscript/vbulletin_facebook.js?v={vb:raw vboptions.simpleversion}'; var fcb_var = document.getElementsByTagName('script')[0]; fcb_var.parentNode.insertBefore(fcb_js, fcb_var); </script> HTML Code:
<script type="text/javascript"> (function() { var test = document.createElement('script'); test.type = 'text/javascript'; test.async = true; test.src ='/clientscript/vbulletin_facebook.js?v={vb:raw vboptions.simpleversion}'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(test, s); })(); </script> Any ideas?? Note:: any kind of page tester that I test my forum seems to detect the vbulletin_facebook.js at the same position as with the standard code... md5.js and vbulletin-markert.js are loaded and seems to work fine, and css files such as additional.css etc are not tested yet but I think may have a problem with that too!!! Thank you !! |
#2
|
|||
|
|||
*SOLVED*
It's working as below: HTML Code:
<script type="text/javascript"> (function() { var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0]; s.type = 'text/javascript'; s.async = true; s.src = '/clientscript/vbulletin-core.js?v={vb:raw vboptions.simpleversion}'; s1.parentNode.insertBefore(s, s1); })(); </script> If you want to use the defer js, for all your java files used above code. if your using cdn it will not work, so you need to replace the source with the exactly address, for example:: Code:
'http://pullzone-anymvs.netdna-cdn.com/clientscript/vbulletin-core.js?v={vb:raw vboptions.simpleversion}' ?v={vb:raw vboptions.simpleversion} from all your js file after you enable cache header.. Note: This is working for me and it's a good idea to used it especially if your running on a simple hosting. it will not make your side load 10 times faster but it will reduce the time load of js files at all, especially for users that they use IE as browsing. TIP: load your css files as HTML Code:
<link rel="stylesheet" type="text/css" href="http://pullzone-anymvs.netdna-cdn.com/clientscript/vbulletin_css/style00014l/additional.css" />
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|