Support » Plugin: AMP » Javascript Widget Displays as Blank Space

  • Resolved Elkerton



    I am trying to display a javascript widget on my AMP WordPress site, but the page only displays a blank space. I have run the header and widget script through the AMP Validator and there were no errors.

    Following is the header script:
    <script async custom-element="amp-script" src=""></script>

    Following is the widget script:

    <amp-script src=''>

    Thank you for your assistance.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Weston Ruter


    Hello. This is not a proper use of amp-script. The amp-script component is not a drop-in replacement for script tags. The JavaScript being embedded has to abide by certain constraint, and one of them is that document.write() is not allowed.

    In order to embed this widget, you’ll have to iframe it.

    For example, create an HTML page that contains the following:

    <!DOCTYPE html>
    		<meta charset="utf-8">
    		<style>html,body {margin:0; padding:0}</style>
    		<script src=''></script>

    Place it on your site, for example at

    Then you can embed it in your site via:

    <iframe width="350" height="233" layout="fixed" frameborder="0" scrolling="no" sandbox="allow-scripts" src="">

    Note that the AMP plugin will automatically convert this to an amp-iframe.

    Thank you Weston – this worked splendidly. And yes, I found it works best to use the standard iframe tags and let AMP do the rest.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.