Announcement

Collapse
No announcement yet.

Lighthouse flags calls to document.write()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Lighthouse flags calls to document.write()

    How the heck do these get "fixed". From what I can gather they are coming from things like the Authorize.net's seal and the Trust logo for the secure certificate. Should these just be removed???
    Leslie Kirk
    Miva Certified Developer
    Miva Merchant Specialist since 1997
    Previously of Webs Your Way
    (aka Leslie Nord leslienord)

    Email me: [email protected]
    www.lesliekirk.com

    Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

    #2
    Hi Leslie,

    According to sources like GTmetrix, https://gtmetrix.com/avoid-document-write.html
    Matt Zimmermann

    Miva Web Developer
    Alchemy Web Development
    https://www.alchemywebdev.com
    Site Development - Maintenance - Consultation

    Miva Certified Developer
    Miva Professional Developer

    https://www.dev4web.net | Twitter

    Comment


      #3
      Originally posted by Matt Zimmermann View Post
      Hi Leslie,

      According to sources like GTmetrix, https://gtmetrix.com/avoid-document-write.html
      Also Lighthouse - but what do you do when it's part of the script provided by places like Auth.net and the secure cert folks like Sectigo?
      Leslie Kirk
      Miva Certified Developer
      Miva Merchant Specialist since 1997
      Previously of Webs Your Way
      (aka Leslie Nord leslienord)

      Email me: [email protected]
      www.lesliekirk.com

      Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

      Comment


        #4
        Hi Leslie,

        If you cannot apply something like "async" to their script, then I would contact the vendor and see what can be done about it.
        Matt Zimmermann

        Miva Web Developer
        Alchemy Web Development
        https://www.alchemywebdev.com
        Site Development - Maintenance - Consultation

        Miva Certified Developer
        Miva Professional Developer

        https://www.dev4web.net | Twitter

        Comment


          #5
          Originally posted by Matt Zimmermann View Post
          Hi Leslie,

          If you cannot apply something like "async" to their script, then I would contact the vendor and see what can be done about it.
          I went to both websites to see if they have updated code - Comodo didn't. I haven't checked Auth.net. You would have hoped they would have been much more proactive.
          Leslie Kirk
          Miva Certified Developer
          Miva Merchant Specialist since 1997
          Previously of Webs Your Way
          (aka Leslie Nord leslienord)

          Email me: [email protected]
          www.lesliekirk.com

          Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

          Comment


            #6
            I'm working on something similar and am wondering if you could create an asynchronous loader script to bring in authorize and trustlogo:

            Code goes within script tags with async attribute.
            I can't post a script tag but the idea is that this script loads asynchronously which then creates the third party scripts.

            Code:
            function createScript(url, location, href, title, text) {
                var script = document.createElement('script');
                script.src = url;
                location.appendChild(script);
            
                var a = document.createElement('a');
                a.href = href;
                a.title = title;
                a.createTextNode = text;
                script.appendChild(a);
            }
            
            authorize = 'some_url'; // third-party script url
            trustlogo = 'some_url'; // third-party script url
            
            createScript(authorize, document.body, href, title, text);
            createScript(trustlogo, document.body, href, title, text);
            here is link to stackoverflow:

            https://stackoverflow.com/questions/...d-js-inside-js
            Last edited by alphabet; 07-18-21, 04:10 PM. Reason: Edit problem entering script tag within code block
            http://www.alphabetsigns.com/

            Comment


              #7
              never actually tried this, but had a similar thought that might be easier to pull off (if it works).

              Add the trust(etc) script into a readytheme content container, then wrap an AJAX (or mvt:call) call to the content container at the end of the document.
              Bruce Golub
              Phosphor Media - "Your Success is our Business"

              Improve Your Customer Service | Get MORE Customers | Edit CSS/Javascript/HTML Easily | Make Your Site Faster | Get Indexed by Google | Free Modules | Follow Us on Facebook
              phosphormedia.com

              Comment


                #8
                Hey Bruce,

                I like your idea better. It's a lot less code and easier to maintain.
                http://www.alphabetsigns.com/

                Comment

                Working...
                X