Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2008
    Location
    Qld, Australia
    Posts
    257
    Plugin Contributions
    6

    Default js scripts invoked using document.write

    zc156a
    While using Chrome dev tools I receive warnings about admin | orders and calls to jquery using document.write

    Warning message is "A parser-blocking, cross site (i.e. different eTLD+1) script,, https://code.jquery.com/jquery-3.3.1.min.js, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. "

    This is from the beginning of admin\includes\javascript_loader.php

    Code:
    <script>window.jQuery || document.write('<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"><\/script>');</script>
    <script>window.jQuery || document.write('<script src="includes/javascript/jquery-3.3.1.min.js"><\/script>');</script>
    Should this be redesigned to improve performance?

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: js scripts invoked using document.write

    Quote Originally Posted by OldNGrey View Post
    Should this be redesigned to improve performance?
    "Improve performance"? If "performance" is defined (as it often is in the context of javascript) as "better speed of page loads", then, no it wouldn't improve performance.

    It's a fallback/catch-all intended to fire only if the previously expected jquery code didn't, for some reason. Therefore it actually improves things, as in prevents things from breaking worse.
    Sometimes the things intended to save people from themselves are quite misunderstood by Google's attempts to save people from themselves.
    .

    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.

 

 

Similar Threads

  1. v154 AJAX errors document.write
    By pasi in forum Bug Reports
    Replies: 2
    Last Post: 18 Mar 2015, 07:53 AM
  2. Upgrade to 1.3.9e using Simple Scripts or not?
    By Athens Collectibles in forum Installing on a Linux/Unix Server
    Replies: 10
    Last Post: 8 Aug 2010, 05:16 AM
  3. Using custom scripts
    By Queenjava in forum General Questions
    Replies: 2
    Last Post: 16 Oct 2008, 04:46 PM
  4. document.write Error?
    By kobra in forum Upgrading from 1.3.x to 1.3.9
    Replies: 2
    Last Post: 26 Mar 2008, 02:40 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR