I guess it does....Yours blinks too, kobra ...
I guess it does....Yours blinks too, kobra ...
Zen-Venom Get Bitten
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Chris,
Where jQuery CDN is fine in the html_header, it should be included as Asynchronous JavaScript though.
Sometimes simple is better!
Note: asynchronous scripts should not use document.writeCode:<script type="text/javascript" async src="//code.jquery.com/jquery-1.12.0.min.js"></script> <script type="text/javascript" async src="<?php echo $template->get_template_dir('.js',DIR_WS_TEMPLATE, $current_page_base,'jscript'); ?>/jquery.min.js"></script>
Adding the async keyword to the script tag tells the browser that it should not block the DOM construction while it waits for the script to become available - this is a huge performance win!
So then a jquery plugin that's loaded without the 'async' attribute will still run into problems though, right? (or, at least if the async call to the jquery CDN hasn't finished loading yet)
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
So, what's the choice in this scenario for a plugin that needs jQuery? Should the plugin load its jQuery bit with the async attribute as well?
Honestly,
I'll have to look at this more, the solution provided works and prevents the blank or "blink" before page loads but it isn't a solution for the vast majority and will require all jscript to include that attribute.
Bookmarks