Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors in Chrome Console (Tag Disallowed) #336

Closed
JPratley opened this issue Mar 16, 2016 · 9 comments
Closed

Errors in Chrome Console (Tag Disallowed) #336

JPratley opened this issue Mar 16, 2016 · 9 comments

Comments

@JPratley
Copy link

I've installed the AMP plugin, but I have errors in Chrome Console. I have two errors saying "The tag 'script' is disallowed except in specific forms." How do I fix these?
The article I'm testing is here: https://pratters.com/android-n-features-id-like-to-see/amp/
screen shot 2016-03-16 at 04 53 01

@mjangda
Copy link
Contributor

mjangda commented Mar 16, 2016

Something is injecting javascript into the page which is not allowed:

<script type="text/javascript">window.NREUM||(NREUM={}),__nr_require=function(e,t,n){function r(n){if(!t[n]){var o=t[n]={exports:{}};e[n][0].call(o.exports,function(t){var o=e[n][1][t];return r(o||t)},o,o.exports)}return t[n].exports}if("function"==typeof __nr_require)return __nr_require;for(var o=0;o<n.length;o++)r(n[o]);return r}({1:[function(e,t,n){function r(e,t){return function(){o

Looks like New Relic? You should disabled it for AMP pages.

@mjangda mjangda closed this as completed Mar 16, 2016
@JPratley
Copy link
Author

I do not understand where this New Relic javascript is coming from, as I do not have New Relic installed and have not heard of it before. Therefore, I'm unsure how I can delete this. I contacted New Relic customer support, and they could not help me either.

@larsschenk
Copy link

if (stripos($_SERVER['REQUEST_URI'], '/amp/')) {
    if (extension_loaded('newrelic')) {
        newrelic_disable_autorum();
    }
}

@npbtrac
Copy link

npbtrac commented Jan 10, 2019

@larsschenk I know this is an old thread but I just want to say thank you to save-my-day snippet.

@westonruter
Copy link
Member

@npbtrac note that this snippet should no longer be required as it is done by the AMP plugin itself as of 0.7: #932

@npbtrac
Copy link

npbtrac commented Jan 11, 2019

Thanks @westonruter, just because I didn't use the https://github.com/ampproject/amp-wp but I purchased for Theme Newspaper from TagDiv and they provide AMP and current PHP installation had that NewRelic things so it made a headache so far. BTW, I would like to contribute to https://github.com/ampproject/amp-wp but I can't find the guides to join on Wiki page, can you please show me how (I used to serve NewsCorp AUS where I work on code from XWP).

@westonruter
Copy link
Member

@npbtrac You can find information for contributing here: https://github.com/ampproject/amp-wp/blob/develop/contributing.md

@walismar
Copy link

with this code

if (stripos ($ _ SERVER ['REQUEST_URI'], '/ amp /')) {
     if (extension_loaded ('newrelic')) {
         newrelic_disable_autorum ();
     }
}

we can block the extension of new relic at the AMP level, which is where the error in Search Console gives us, the question would be where exactly we should place said code?

Thank you

@westonruter
Copy link
Member

@walismar The AMP plugin is already doing this as of v0.7:

amp-wp/amp.php

Lines 319 to 322 in 2cab5bb

// Prevent New Relic from causing invalid AMP responses due the NREUM script it injects after the meta charset.
if ( extension_loaded( 'newrelic' ) ) {
newrelic_disable_autorum();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants