简体   繁体   English

WordPress自定义主题具有mod-pagespeed在页面重新加载时没有延迟404错误

[英]Wordpress Custom Theme has mod-pagespeed no defer 404 error on page reload

ISSUE: On page reload of a Wordpress 4.1 custom theme, I get the error "GET ... /%3Cscript%20pagespeed_no_defer= 404 (Not Found)" in my console, and on the web page it shows script. 问题:在重新加载Wordpress 4.1自定义主题的页面上,我的控制台中出现错误“ GET ... /%3Cscript%20pagespeed_no_defer = 404(未找到)”,并且在网页上显示了脚本。 If I refresh a few more times, it goes away, then another refresh and it returns. 如果我再刷新几次,它将消失,然后再次刷新,然后返回。

GOAL / QUESTION: Guidance on how to further troubleshoot this error? 目标/问题:有关如何进一步解决此错误的指南? Is this as simple as disabling only this feature? 这与仅禁用此功能一样简单吗? Most importantly, I would like to understand WHY this issue occurred. 最重要的是,我想了解为什么会发生此问题。 Thank you for your time! 感谢您的时间!

WORKAROUND: If I disable pagespeed in the httpd.conf, the issue goes away. 解决方法:如果我在httpd.conf中禁用了pagespeed,问题就消失了。

ENVIRONMENT: Client: OS X 10.10.2, Chrome 40.0.2214.94 (64-bit), Safari 8.0.3, FF 35.0.1; 环境:客户端:OS X 10.10.2,Chrome 40.0.2214.94(64位),Safari 8.0.3,FF 35.0.1; Server: Bitnami VM, Ubuntu 14.04, Wordpress 4.1 服务器:Bitnami VM,Ubuntu 14.04,Wordpress 4.1

BACKGROUND: I am creating a basic Wordpress theme. 背景:我正在创建一个基本的Wordpress主题。 I started off with the template from underscores.me/ and added in some generic .js (bootstrap, etc...) When I loaded the page for the first time, it looked fine. 我从underscores.me/开始使用模板,并添加了一些通用的.js(bootstrap等)。当我第一次加载页面时,它看起来还不错。 When I hit refresh, it threw js code into the body. 当我点击刷新时,它会将js代码放入正文中。 I am new to using PageSpeed, so any guidance would be appreciated. 我是使用PageSpeed的新手,所以任何指导都将不胜感激。 I have other themes and plug-ins I have developed, but this is a new issue for me. 我还开发了其他主题和插件,但这对我来说是新问题。

REFERENCE LINKS: 参考链接:
https://forums.plex.tv/index.php/topic/98618-script-appears-in-reply-as-text-when-doing-quote-reply-on-forum/ Best match to what I am seeing, and the work around I used... https://forums.plex.tv/index.php/topic/98618-script-appears-in-reply-as-text-when-doing-quote-reply-on-forum/ 与我所看到的最匹配,和我以前的工作...

https://developers.google.com/speed/pagespeed/service/DeferJavaScript If the answer is here, I am not seeing it... https://developers.google.com/speed/pagespeed/service/DeferJavaScript 如果答案在这里,我看不到...

I also had more links, but these were the most relevant. 我也有更多链接,但这是最相关的。

Here is an example when the page loads correctly... 这是页面正确加载时的示例...

<html lang="en-US">    <head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="http://192.168.70.130/xmlrpc.php">

<title>NV | NVWPDEVSPM03    </title>
<link rel="alternate" type="application/rss+xml" title="NV » Feed" href="http://192.168.70.130/feed/">
<link rel="alternate" type="application/rss+xml" title="NV » Comments Feed" href="http://192.168.70.130/comments/feed/">
<link rel="alternate" type="application/rss+xml" title="NV » Home Comments Feed" href="http://192.168.70.130/home/feed/">
<link rel="stylesheet" id="open-sans-css" href="//fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&amp;subset=latin%2Clatin-ext&amp;ver=4.1" type="text/css" media="all">
<link rel="stylesheet" id="dashicons-css" href="http://192.168.70.130/wp-includes/css/dashicons.min.css,qver=4.1.pagespeed.ce.UZxcrXP6ne.css" type="text/css" media="all">
<link rel="stylesheet" id="admin-bar-css" href="http://192.168.70.130/wp-includes/css/admin-bar.min.css,qver=4.1.pagespeed.ce.ijxCXNyHcG.css" type="text/css" media="all">
<link rel="stylesheet" id="nvapp2015-style-css" href="http://192.168.70.130/wp-content/themes/nvapp2015_s/A.style.css,qver=4.1.pagespeed.cf.bZbMpNtUMT.css" type="text/css" media="all">
<link rel="stylesheet" id="nvapp2015-bootstrap-min-style-css" href="http://192.168.70.130/wp-content/themes/nvapp2015_s/css/A.bootstrap.min.css,qver=4.1.pagespeed.cf.XAf2gFe0Gs.css" type="text/css" media="all">
<link rel="stylesheet" id="nvapp2015-font-awesome-min-style-css" href="http://192.168.70.130/wp-content/themes/nvapp2015_s/css/A.font-awesome.min.css,qver=4.1.pagespeed.cf.HpcIsdYD5q.css" type="text/css" media="all">
<link rel="stylesheet" id="nvapp2015-jquery-ui-min-style-css" href="http://192.168.70.130/wp-content/themes/nvapp2015_s/css/A.jquery-ui.min.css,qver=4.1.pagespeed.cf.L5sry_GBdl.css" type="text/css" media="all">
<link rel="stylesheet" id="nvapp2015-google-roboto-css" href="http://fonts.googleapis.com/css?family=Roboto%3A400%2C300%2C300italic%2C400italic%2C500%2C500italic%2C700%2C700italic&amp;ver=4.1" type="text/css" media="all">
<link rel="stylesheet" id="nvapp2015-user-style-css" href="http://192.168.70.130/wp-content/themes/nvapp2015_s/css/A.nvapp2015-user.css,qver=4.1.pagespeed.cf.fmlN9vVCt3.css" type="text/css" media="all">
<script type="text/javascript" src="http://192.168.70.130/wp-includes/js/jquery/jquery.js,qver=1.11.1.pagespeed.jm.z9hb-Gxqf6.js">    </script>
<script src="http://192.168.70.130/wp-includes,_js,_jquery,_jquery-migrate.min.js,,qver==1.2.1,Mjm.mhpNjdU8Wl.js+wp-content,_themes,_nvapp2015_s,_js,_navigation.js,,qver==4.1,Mjm.6Nd4Vs-f7y.js+wp-content,_themes,_nvapp2015_s,_js,_skip-link-focus-fix.js,,qver==4.1,Mjm.lDnzVc-ohN.js.pagespeed.jc.qEXpdtuky-.js">    </script>    <script>eval(mod_pagespeed_bu58_vox6u);    </script>
<script>eval(mod_pagespeed_rnPp6y$Leu);    </script>
<script>eval(mod_pagespeed_v_mTWgtVPl);    </script>
<script type="text/javascript" src="http://192.168.70.130/wp-content/themes/nvapp2015_s/js/jquery-ui.min.js,qver=4.1.pagespeed.jm.e-HKoI4nbp.js">    </script>
<script type="text/javascript" src="http://192.168.70.130/wp-content/themes/nvapp2015_s/js/bootstrap.min.js,qver=4.1.pagespeed.jm.-kRHVQtEas.js">    </script>
<script src="http://192.168.70.130/wp-content/themes/nvapp2015_s/js/jquery.backstretch.min.js,,qver==4.1,Mjm.U1NgPaOuHw.js+nvapp2015-user.js,,qver==4.1,Mjm.AkFrXxuiYg.js.pagespeed.jc.P6xbyh4_sf.js">    </script>    <script>eval(mod_pagespeed_nEk421u75r);    </script>
<script>eval(mod_pagespeed_KWmGPAZujM);    </script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://192.168.70.130/xmlrpc.php?rsd">
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://192.168.70.130/wp-includes/wlwmanifest.xml"> 
<meta name="generator" content="WordPress 4.1">
<link rel="canonical" href="http://192.168.70.130/">
<link rel="shortlink" href="http://192.168.70.130/">
    <style type="text/css">.recentcomments a{display:inline!important;padding:0!important;margin:0!important}    </style>
<style type="text/css" id="custom-background-css">body.custom-background{background-image:url(http://192.168.70.130/wp-content/uploads/2015/02/xhome-bg.png.pagespeed.ic.NgaIrW3Bbh.png);background-repeat:no-repeat;background-position:top left;background-attachment:scroll}    </style>
<style type="text/css" media="print">#wpadminbar{display:none}    </style>
<style type="text/css" media="screen">html{margin-top:32px!important}* html body{margin-top:32px!important}@media screen and (max-width:782px ){html{margin-top:46px!important}* html body{margin-top:46px!important}}    </style>
</head>

<body class="home page page-id-7 page-template page-template-nvapp2015-page-home page-template-nvapp2015-page-home-php logged-in admin-bar no-customize-support custom-background">    <noscript>&lt;meta HTTP-EQUIV="refresh" content="0;url='http://192.168.70.130/?ModPagespeed=noscript'" /&gt;&lt;style&gt;&lt;!--table,div,span,font,p{display:none} --&gt;&lt;/style&gt;&lt;div style="display:block"&gt;Please click &lt;a href="http://192.168.70.130/?ModPagespeed=noscript"&gt;here&lt;/a&gt; if you are not redirected within a few seconds.&lt;/div&gt;    </noscript>
<div id="page" class="hfeed site">
    <a class="skip-link screen-reader-text" href="#content">Skip to content    </a>

    <header id="masthead" class="site-header" role="banner">
        <div class="site-branding">
            <h1 class="site-title">    <a href="http://192.168.70.130/" rel="home">NV   </a>    </h1>
            <h2 class="site-description">NVWPDEVSPM03    </h2>
        </div>    <!-- .site-branding -->

        <nav id="site-navigation" class="main-navigation" role="navigation">
            <button class="menu-toggle" aria-controls="menu" aria-expanded="false">Primary Menu    </button>
            <div class="menu">    <ul>    <li class="page_item page-item-7 current_page_item">    <a href="http://192.168.70.130/">Home    </a>    </li>    </ul>    </div>
        </nav>    <!-- #site-navigation -->
    </header>    <!-- #masthead -->

    <div id="content" class="site-content">

    <div id="primary" class="content-area">


    </div>    <!-- #primary -->
    </div>    </div>    </body>    </html>

And here it is broken... (last 3 lines) 这是坏的...(最后三行)

<html lang="en-US">    <head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="http://192.168.70.130/xmlrpc.php">

<title>NV | NVWPDEVSPM03    </title>
<link rel="alternate" type="application/rss+xml" title="NV » Feed" href="http://192.168.70.130/feed/">
<link rel="alternate" type="application/rss+xml" title="NV » Comments Feed" href="http://192.168.70.130/comments/feed/">
<link rel="alternate" type="application/rss+xml" title="NV » Home Comments Feed" href="http://192.168.70.130/home/feed/">
<link rel="stylesheet" id="open-sans-css" href="//fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&amp;subset=latin%2Clatin-ext&amp;ver=4.1" type="text/css" media="all">
<link rel="stylesheet" id="dashicons-css" href="http://192.168.70.130/wp-includes/css/dashicons.min.css,qver=4.1.pagespeed.ce.UZxcrXP6ne.css" type="text/css" media="all">
<link rel="stylesheet" id="admin-bar-css" href="http://192.168.70.130/wp-includes/css/admin-bar.min.css,qver=4.1.pagespeed.ce.ijxCXNyHcG.css" type="text/css" media="all">
<link rel="stylesheet" id="nvapp2015-style-css" href="http://192.168.70.130/wp-content/themes/nvapp2015_s/A.style.css,qver=4.1.pagespeed.cf.bZbMpNtUMT.css" type="text/css" media="all">
<link rel="stylesheet" id="nvapp2015-bootstrap-min-style-css" href="http://192.168.70.130/wp-content/themes/nvapp2015_s/css/A.bootstrap.min.css,qver=4.1.pagespeed.cf.XAf2gFe0Gs.css" type="text/css" media="all">
<link rel="stylesheet" id="nvapp2015-font-awesome-min-style-css" href="http://192.168.70.130/wp-content/themes/nvapp2015_s/css/A.font-awesome.min.css,qver=4.1.pagespeed.cf.HpcIsdYD5q.css" type="text/css" media="all">
<link rel="stylesheet" id="nvapp2015-jquery-ui-min-style-css" href="http://192.168.70.130/wp-content/themes/nvapp2015_s/css/jquery-ui.min.css?ver=4.1" type="text/css" media="all">
<link rel="stylesheet" id="nvapp2015-google-roboto-css" href="http://fonts.googleapis.com/css?family=Roboto%3A400%2C300%2C300italic%2C400italic%2C500%2C500italic%2C700%2C700italic&amp;ver=4.1" type="text/css" media="all">
<link rel="stylesheet" id="nvapp2015-user-style-css" href="http://192.168.70.130/wp-content/themes/nvapp2015_s/css/nvapp2015-user.css?ver=4.1" type="text/css" media="all">
<script type="text/javascript" src="http://192.168.70.130/wp-includes/js/jquery/jquery.js,qver=1.11.1.pagespeed.jm.z9hb-Gxqf6.js">    </script>
<script src="http://192.168.70.130/wp-includes,_js,_jquery,_jquery-migrate.min.js,,qver==1.2.1,Mjm.mhpNjdU8Wl.js+wp-content,_themes,_nvapp2015_s,_js,_navigation.js,,qver==4.1,Mjm.6Nd4Vs-f7y.js+wp-content,_themes,_nvapp2015_s,_js,_skip-link-focus-fix.js,,qver==4.1,Mjm.lDnzVc-ohN.js.pagespeed.jc.qEXpdtuky-.js">    </script>    <script>eval(mod_pagespeed_bu58_vox6u);    </script>
<script>eval(mod_pagespeed_rnPp6y$Leu);    </script>
<script>eval(mod_pagespeed_v_mTWgtVPl);    </script>
<script type="text/javascript" src="http://192.168.70.130/wp-content/themes/nvapp2015_s/js/jquery-ui.min.js,qver=4.1.pagespeed.jm.e-HKoI4nbp.js">    </script>
<script type="text/javascript" src="http://192.168.70.130/wp-content/themes/nvapp2015_s/js/bootstrap.min.js,qver=4.1.pagespeed.jm.-kRHVQtEas.js">    </script>
<script src="http://192.168.70.130/wp-content/themes/nvapp2015_s/js/jquery.backstretch.min.js,,qver==4.1,Mjm.U1NgPaOuHw.js+nvapp2015-user.js,,qver==4.1,Mjm.AkFrXxuiYg.js.pagespeed.jc.P6xbyh4_sf.js">    </script>    <script>eval(mod_pagespeed_nEk421u75r);    </script>
<script>eval(mod_pagespeed_KWmGPAZujM);    </script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://192.168.70.130/xmlrpc.php?rsd">
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://192.168.70.130/wp-includes/wlwmanifest.xml"> 
<meta name="generator" content="WordPress 4.1">
<link rel="canonical" href="http://192.168.70.130/">
<link rel="shortlink" href="http://192.168.70.130/">
    <style type="text/css">.recentcomments a{display:inline!important;padding:0!important;margin:0!important}    </style>
<style type="text/css" id="custom-background-css">body.custom-background{background-image:url(http://192.168.70.130/wp-content/uploads/2015/02/xhome-bg.png.pagespeed.ic.NgaIrW3Bbh.png);background-repeat:no-repeat;background-position:top left;background-attachment:scroll}    </style>
<style type="text/css" media="print">#wpadminbar{display:none}    </style>
<style type="text/css" media="screen">html{margin-top:32px!important}* html body{margin-top:32px!important}@media screen and (max-width:782px ){html{margin-top:46px!important}* html body{margin-top:46px!important}}    </style>
</head>

<body class="home page page-id-7 page-template page-template-nvapp2015-page-home page-template-nvapp2015-page-home-php logged-in admin-bar no-customize-support custom-background">    <noscript>&lt;meta HTTP-EQUIV="refresh" content="0;url='http://192.168.70.130/?ModPagespeed=noscript'" /&gt;&lt;style&gt;&lt;!--table,div,span,font,p{display:none} --&gt;&lt;/style&gt;&lt;div style="display:block"&gt;Please click &lt;a href="http://192.168.70.130/?ModPagespeed=noscript"&gt;here&lt;/a&gt; if you are not redirected within a few seconds.&lt;/div&gt;    </noscript>
<div id="page" class="hfeed site" style="position: relative; z-index: 0; background: none;">
    <a class="skip-link screen-reader-text" href="#content">Skip to content    </a>

    <header id="masthead" class="site-header" role="banner">
        <div class="site-branding">
            <h1 class="site-title">    <a href="http://192.168.70.130/" rel="home">NV    </a>    </h1>
            <h2 class="site-description">NVWPDEVSPM03    </h2>
        </div>    <!-- .site-branding -->

        <nav id="site-navigation" class="main-navigation" role="navigation">
            <button class="menu-toggle" aria-controls="menu" aria-expanded="false">Primary Menu    </button>
            <div class="menu">    <ul>    <li class="page_item page-item-7 current_page_item">    <a href="http://192.168.70.130/">Home    </a>    </li>    </ul>    </div>
        </nav>    <!-- #site-navigation -->
    </header>    <!-- #masthead -->

    <div id="content" class="site-content">

    <div id="primary" class="content-area">


    </div>    <!-- #primary -->
    <input type="hidden" id="bg_image" value="    <script pagespeed_no_defer=" "="">//    <!--[CDATA[
(function(){var e=encodeURIComponent,f=window,h=document,m="width",n="documentElement",p="height",q="length",r="prototype",s="body",t="&",u="&ci=",w="&n=",x="&rd=",y=",",z="?",A="Content-Type",B="Microsoft.XMLHTTP",C="Msxml2.XMLHTTP",D="POST",E="application/x-www-form-urlencoded",F="img",G="input",H="load",I="oh=",J="on",K="pagespeed_url_hash",L="url=",M=function(a,c,d){if(a.addEventListener)a.addEventListener(c,d,!1);else if(a.attachEvent)a.attachEvent(J+c,d);else{var b=a[J+c];a[J+c]=function(){d.call(this);b&&b.call(this)}}};f.pagespeed=f.pagespeed||{};var N=f.pagespeed,O=function(a,c,d,b,g){this.d=a;this.f=c;this.g=d;this.a=g;this.c={height:f.innerHeight||h[n].clientHeight||h[s].clientHeight,width:f.innerWidth||h[n].clientWidth||h[s].clientWidth};this.e=b;this.b={}};O[r].j=function(a){a=a.getBoundingClientRect();return{top:a.top+(void 0!==f.pageYOffset?f.pageYOffset:(h[n]||h[s].parentNode||h[s]).scrollTop),left:a.left+(void 0!==f.pageXOffset?f.pageXOffset:(h[n]||h[s].parentNode||h[s]).scrollLeft)}};O[r].i=function(a){if(0-->=a.offsetWidth&amp;&amp;0&gt;=a.offsetHeight)return!1;a=this.j(a);var c=a.top.toString()+y+a.left.toString();if(this.b.hasOwnProperty(c))return!1;this.b[c]=!0;return a.top&lt;=this.c[p]&amp;&amp;a.left&lt;=this.c[m]};O[r].l=function(){for(var a=[F,G],c=[],d={},b=0;b    <a[q];++b)for(var g="h.getElementsByTagName(a[b]),k=0;k    <g[q];++k){var" v="g[k].getAttribute(K);v&amp;&amp;g[k].getBoundingClientRect&amp;&amp;this.i(g[k])&amp;&amp;!(v" in="" d)&&(c.push(v),d[v]="!0)}b=!1;a=I+this.g;this.a&amp;&amp;(a+=w+this.a);if(0!=c[q]){a+=u+e(c[0]);for(b=1;b    <c[q];++b){d=y+e(c[b]);if(131072    <a[q]+d[q])break;a+=d}b=!0}this.e&amp;&amp;(d=x+e(JSON.stringify(this.h())),131072">=a[q]+d[q]&amp;&amp;(a+=d),b=!0);N.criticalImagesBeaconData=a;if(b){var c=this.d,b=this.f,l;if(f.XMLHttpRequest)l=new XMLHttpRequest;else if(f.ActiveXObject)try{l=new ActiveXObject(C)}catch(P){try{l=new ActiveXObject(B)}catch(Q){}}l&amp;&amp;(l.open(D,c+(-1==c.indexOf(z)?z:t)+L+e(b)),l.setRequestHeader(A,E),l.send(a))}};O[r].h=function(){for(var a={},c=h.getElementsByTagName(F),d=0;d    <c[q];++d){var b="c[d],g=b.getAttribute(K);if(&quot;undefined&quot;==typeof" b.naturalwidth||"undefined"="=typeof" b.naturalheight||"undefined"="=typeof" g)break;if("undefined"="=typeof" a[b.src]&&0    <b[m]&&0    <b[p]&&0    <b.naturalwidth&&0    <b.naturalheight||"undefined"!="typeof" a[b.src]&&b[m]="">=a[b.src].n&amp;&amp;b[p]&gt;=a[b.src].m)a[g]={renderedWidth:b[m],renderedHeight:b[p],originalWidth:b.naturalWidth,originalHeight:b.naturalHeight}}return a};N.k=function(a,c,d,b,g){var k=new O(a,c,d,b,g);M(f,H,function(){f.setTimeout(function(){k.l()},0)})};N.criticalImagesBeaconInit=N.k;})();pagespeed.criticalImagesBeaconInit('/mod_pagespeed_beacon','http://192.168.70.130/','O-_tWHm2s1',false,'qIBIt6eWWcg');
//]]&gt;    </c[q];++d){var>    </a[q];++b)for(var>    </div>    <div class="backstretch" style="left: 0px; top: 0px; overflow: hidden; margin: 0px; padding: 0px; height: 100%; width: 100%; z-index: -999998; position: absolute;">    <img src="&lt;script pagespeed_no_defer=" style="position: absolute; display: none; margin: 0px; padding: 0px; border: none; width: auto; height: auto; max-height: none; max-width: none; z-index: -999999;">    </div>    </div>    </body>    </html>

解决方法:如果我在httpd.conf中禁用了pagespeed,问题就消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM