amp-html

External Style Sheet is not valid in AMP Pages

拈花ヽ惹草 提交于 2019-11-28 12:54:10
I am converting my HTML page into AMP Pages. I have seen test url https://validator.ampproject.org/# . This page is validate from AMP. Screen Shot for Help: But When I used External Css. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/css/materialize.min.css"> Then It will fail. Screen Shot For help. Then how can I access materialize css file. Because I am using Materialize Ui framework in my website. But I have read also about <style amp-custom> </style> SO AMP validate page suggest include inline css in amp-custom. But materialize css is so long. It

Add Javascript in AMP Pages

感情迁移 提交于 2019-11-28 09:23:30
Please help me understand how to add javascript in the AMP (Accelerated Mobile Pages). My requirement is I get an ID in URL. For example localhost:8080/home?id=1.I would like to access that id in my html file. or else please let me know how to add any javascript file. Thank you. Unfortunately, you cannot add arbitrary scripts in AMP. From the specification , under "HTML Tags," for the tag script : Prohibited unless the type is application/ld+json . (Other non-executable values may be added as needed.) Exception is the mandatory script tag to load the AMP runtime and the script tags to load

AMP: easy way to toggle a CSS class?

爱⌒轻易说出口 提交于 2019-11-28 08:30:43
I'm build an Accelerated Mobile Page (AMP) template and was wondering if there is an easy way of toggling a CSS class on tab. I know about stuff like: <h2 class="headline" on="tap:list.toggleVisibility" > <ul id="list"></ul> But this writes inline-styles - I'd rather toggle a custom CSS class but couldn't find an example on the AMP page. AMP.setState with bindings like <h2 [class]="myclasses"> looked like the way to go but manipulating the state is pretty hard with the tools they give you ... This can be done via amp-bind . You can use an implicit state variable, e.g. visible , to track the

AMP-html page not displaying as intended in Google Search

泪湿孤枕 提交于 2019-11-28 05:40:29
问题 I have been reading through the possibilities of AMP, but I cannot seem to grasp why my page is not showing like Google shows it in their demo (see http://g.co/amp). My regular page is this: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>An example of an AMP Project; a part of a self-writen paper about maintainability</title> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <meta name="language" content="NL"/> <meta name="description" content="Every

AMP Form submission redirect or response

夙愿已清 提交于 2019-11-27 15:36:29
问题 Good morning, I have a form on a test AMP page (is AMP validate) and the form works: I receive the email with result (I use a php to handle it). I don't know (I did some try but I think I still missing an example) the syntax for let the AMP page responce correctly (now I get "Subscription failed!" but I do get the email) or redirect after submission. Here my example: AMP page with form (I receive form result after submission but I don't know how to redirect or get "Subscription successful!"

Running JavaScript in AMP

荒凉一梦 提交于 2019-11-27 08:29:47
I am a bit confused as to how JavaScript is suppposed to be run in an AMP page. I got as far as understanding that my JavaScript must be executed in an iframe. Such iframe has to be placed down in the page (75% at least from top) and has to be served through https. This does indeed work: <amp-iframe width=300 height=300 sandbox="allow-scripts allow-popups allow-popups-to-escape-sandbox" layout="responsive" frameborder="0" src="https://localhost:8000/?p=myjs"> </amp-iframe> In that page ( https://localhost:8000/?p=myjs ) I can freely run my js. My problem is the following though: How am I

External Style Sheet is not valid in AMP Pages

﹥>﹥吖頭↗ 提交于 2019-11-27 07:14:27
问题 I am converting my HTML page into AMP Pages. I have seen test url https://validator.ampproject.org/#. This page is validate from AMP. Screen Shot for Help: But When I used External Css. <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/css/materialize.min.css"> Then It will fail. Screen Shot For help. Then how can I access materialize css file. Because I am using Materialize Ui framework in my website. But I have read also about <style amp-custom> </style>

Google AMP best way to write JS script tag

自作多情 提交于 2019-11-27 04:32:29
I have read all documentation about script tag but I cannot find how to write script tag in AMP HTML page although I know "script tag is Prohibited unless the type is application/ld+json ". They have some default AMP runtime components and extended components which contain specific form for different components. I could not find what is specific form for custom js in AMP HTML. Here is my script tag: <script src="https://arifkarim.com/widget/layouts/global/js/legaltext.js"></script> The whole point of AMP is to only allow a subset of web technologies to stop your page being slow. Javascript is

Add Javascript in AMP Pages

二次信任 提交于 2019-11-27 02:50:43
问题 Please help me understand how to add javascript in the AMP (Accelerated Mobile Pages). My requirement is I get an ID in URL. For example localhost:8080/home?id=1.I would like to access that id in my html file. or else please let me know how to add any javascript file. Thank you. 回答1: Unfortunately, you cannot add arbitrary scripts in AMP. From the specification, under "HTML Tags," for the tag script : Prohibited unless the type is application/ld+json . (Other non-executable values may be

AMP Access Control Allow Source Origin header Issue

…衆ロ難τιáo~ 提交于 2019-11-26 21:00:34
问题 How can I resolve the error below; Failed to load resource: the server responded with a status of 500 (Internal Server Error) cdn.ampproject.org/v0.js:68 Response must contain the AMP-Access-Control-Allow-Source-Origin header Yd @ cdn.ampproject.org/v0.js:68 cdn.ampproject.org/v0.js:68 Form submission failed: Error: Response must contain the AMP-Access-Control-Allow-Source-Origin header​​​ reported Followed all instructions at the AMP GitHub Page on CORS. Below is a screenshot of my PHP code