Support » Plugin: Flying Scripts » Scripts don’t load when logged in

  • Hey Gijo,

    I installed Flying Scripts today and it works fine on the front end. However when I browse the site when logged in, none of the delayed scripts load if I’m the admin user. I use W3TC for page caching etc, is there anything else I should do so Flying Scripts doesn’t run if I’m logged in?



Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter lozula


    Just to clarify, it’s not the admin pages that are the problem, it’s the scripts that should be loading on the front end don’t load when I’m logged in as admin. I have W3TC disabled for logged in users.

    Thread Starter lozula


    For further information, the script is replaced with the following in the source when logged in:

    <script type='text/javascript' defer="defer" id='comment-reply-js' data-type="lazy" data-src="data:text/javascript;base64,"></script>

    Plugin Author Gijo Varghese


    @lozula we rewrite src to data-src so that it won’t execute. Later an inline JS watches for interaction (or timeout) and changes data-src back to src.

    Can you check if the inline JS is enqueued when logged it?

    The script will look like this:

    Thread Starter lozula


    Hi @gijo

    Yes, the inline JS is enqueued. Here’s a paste of the relevant html source code when logged in, which includes one of the tags that’s not being rewritten.

    It looks like the data-src attribute is not being correctly populated. When logged in it has “data:text/javascript;base64” as the value, when logged out, that points to the script location.

    <script async="async" type='text/javascript' id='akismet-form-js' data-type="lazy" data-src="data:text/javascript;base64,"></script><script type="text/javascript" id="flying-scripts">const loadScriptsTimer=setTimeout(loadScripts,3*1000);const userInteractionEvents=["mouseover","keydown","touchmove","touchstart"];userInteractionEvents.forEach(function(event){window.addEventListener(event,triggerScriptLoader,{passive:!0})});function triggerScriptLoader(){loadScripts();clearTimeout(loadScriptsTimer);userInteractionEvents.forEach(function(event){window.removeEventListener(event,triggerScriptLoader,{passive:!0})})}
    function loadScripts(){document.querySelectorAll("script[data-type='lazy']").forEach(function(elem){elem.setAttribute("src",elem.getAttribute("data-src"))})}</script>
        	<script type="text/javascript">
    		(function() {
    			var request, b = document.body, c = 'className', cs = 'customize-support', rcs = new RegExp('(^|\\s+)(no-)?'+cs+'(\\s+|$)');
    				request = true;
    			b[c] = b[c].replace( rcs, ' ' );
    			// The customizer requires postMessage and CORS (if the site is cross domain).
    			b[c] += ( window.postMessage && request ? ' ' : ' no-' ) + cs;
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Scripts don’t load when logged in’ is closed to new replies.