How to defer loading of a Norton Secure Site Seal?

前端 未结 3 1814
刺人心
刺人心 2021-02-09 20:15

I am displaying a Norton Secure Site Seal in a website and I would like to improve the page speed deferring the loading of the seal script. All the tries I\'ve done failed and I

3条回答
  •  野性不改
    2021-02-09 20:38

    I've tried to load seal into a iframe and then put it to where it's intended to be. It works for me. With the help of jQuery. Here it is:

    Create .js file (I called it hackseal.js)

    $(function () {
        if (typeof(vs_hack) !== 'undefined') {
            return;
        }
        vs_hack = true;
        var iframe = document.createElement('iframe');
        var html = '';
        iframe.style.display = 'none';
        document.body.appendChild(iframe);
        iframe.contentWindow.document.open();
        iframe.contentWindow.document.write(html);
        iframe.contentWindow.document.close();
        iframe.onload = function () {
            var copy = ['dn', 'lang', 'tpt', 'vrsn_style', 'splash_url', 'seal_url', 'u1', 'u2', 'sopener', 'vrsn_splash', 'ver', 'v_ua', 're', 'v_old_ie', 'v_mact', 'v_mDown', 'v_resized'];
            for (var copy_i in copy) {
                window[copy[copy_i]] = iframe.contentWindow[copy[copy_i]];
            }
            $('script#seal-sign').replaceWith(iframe.contentWindow.document.body.innerHTML);
        }
    });
    

    Change the original code from this

    
    

    to this

    
    

提交回复
热议问题