More actions
Created page with "# #:''AMP components may have JavaScript under the hood, but they're carefully designed to make sure they don't c..." |
No edit summary |
||
Line 4: | Line 4: | ||
#:''[[while|While]] [[custom]] JS is '''[[allowed]]''' in <a href="../documentation/components/reference/amp-script.md"><code>amp-script</code></a>, and [[third-party]] JS is '''[[allowed]]''' in iframes, it [[cannot]] [[block]] [[rendering]]. [[for example|For example]], if third-party JS [[uses]] the <a href="http://www.stevesouders.com/blog/2012/04/10/dont-docwrite-scripts/">super-bad-for-performance <code>document.write</code> API</a>, it does not block rendering the [[main]] [[page]].''<br><br>Duk da dai '''za a iya''' amfani da rubutun JS na kanka a cikin <a href="../documentation/components/reference/amp-script.md"><code>amp-script</code></a>, kuma za '''a iya amfani''' da JS ɗin waje a cikin iframes, ba zai iya toshe fitowar shafi ba. Misali, idan JS ɗin waje yayi amfani da <a href="http://www.stevesouders.com/blog/2012/04/10/dont-docwrite-scripts/">super-bad-for-performance document.write API</a>, bai toshe fitowar babban shafin ba. | #:''[[while|While]] [[custom]] JS is '''[[allowed]]''' in <a href="../documentation/components/reference/amp-script.md"><code>amp-script</code></a>, and [[third-party]] JS is '''[[allowed]]''' in iframes, it [[cannot]] [[block]] [[rendering]]. [[for example|For example]], if third-party JS [[uses]] the <a href="http://www.stevesouders.com/blog/2012/04/10/dont-docwrite-scripts/">super-bad-for-performance <code>document.write</code> API</a>, it does not block rendering the [[main]] [[page]].''<br><br>Duk da dai '''za a iya''' amfani da rubutun JS na kanka a cikin <a href="../documentation/components/reference/amp-script.md"><code>amp-script</code></a>, kuma za '''a iya amfani''' da JS ɗin waje a cikin iframes, ba zai iya toshe fitowar shafi ba. Misali, idan JS ɗin waje yayi amfani da <a href="http://www.stevesouders.com/blog/2012/04/10/dont-docwrite-scripts/">super-bad-for-performance document.write API</a>, bai toshe fitowar babban shafin ba. | ||
# | # | ||
## [[third-party|Third-party]] JS [[likes]] to use [[synchronous]] JS [[loading]]. | ##''[[third-party|Third-party]] JS [[likes]] to use [[synchronous]] JS [[loading]].'' <> Manhajar JS ta waje na son amfani da yin lodin JS a lokaci ɗaya. | ||
## They also like to <code>document.write</code> more sync scripts. | ##''They also like to <code>document.write</code> more sync scripts.'' <> Kuma suna son amfani da <code>document.write</code> don su daɗa gina tsarin gina manhajojin da ke gudanar da tafiya a lokaci ɗaya. | ||
## For example, if you have five ads on your page, and each of them cause three synchronous loads, each with a 1 second latency connection, you’re in 15 seconds of load time just for JS loading. | ##''For example, if you have five ads on your page, and each of them cause three synchronous loads, each with a 1 second latency connection, you’re in 15 seconds of load time just for JS loading.'' <> Misali, idan kana da tallace-tallace guda biya a shafinka, kuma kowane na haifar da lodin da ke tafiya a lokaci ɗaya sau uku, kowane na ɗaukar ɗakika ɗaya kafin haɗi, ka kasance ka kai daƙiƙoƙi 15 don kawai kana lodin JS. | ||
## AMP pages allow third-party JavaScript but only in sandboxed iframes. | ## AMP pages allow third-party JavaScript but only in sandboxed iframes. | ||
## By restricting them to iframes, they can’t block the execution of the main page. | ## By restricting them to iframes, they can’t block the execution of the main page. | ||
## Even if they trigger multiple style re-calculations, their tiny iframes have very little DOM. | ## Even if they trigger multiple style re-calculations, their tiny iframes have very little DOM. |
Revision as of 16:51, 29 April 2020
-
- AMP components may have JavaScript under the hood, but they're carefully designed to make sure they don't cause performance degradation.
Ɓangarorin AMP kan iya samun JavaScript a ƙarƙashin su, amma an tsara su ne da kula don tabbatar da cewa ba za su jinkirtar da gudanarwar aiki ba. [1]
- AMP components may have JavaScript under the hood, but they're carefully designed to make sure they don't cause performance degradation.
-
- While custom JS is allowed in <a href="../documentation/components/reference/amp-script.md">
amp-script
</a>, and third-party JS is allowed in iframes, it cannot block rendering. For example, if third-party JS uses the <a href="http://www.stevesouders.com/blog/2012/04/10/dont-docwrite-scripts/">super-bad-for-performancedocument.write
API</a>, it does not block rendering the main page.
Duk da dai za a iya amfani da rubutun JS na kanka a cikin <a href="../documentation/components/reference/amp-script.md">amp-script
</a>, kuma za a iya amfani da JS ɗin waje a cikin iframes, ba zai iya toshe fitowar shafi ba. Misali, idan JS ɗin waje yayi amfani da <a href="http://www.stevesouders.com/blog/2012/04/10/dont-docwrite-scripts/">super-bad-for-performance document.write API</a>, bai toshe fitowar babban shafin ba.
- While custom JS is allowed in <a href="../documentation/components/reference/amp-script.md">
-
- Third-party JS likes to use synchronous JS loading. <> Manhajar JS ta waje na son amfani da yin lodin JS a lokaci ɗaya.
- They also like to
document.write
more sync scripts. <> Kuma suna son amfani dadocument.write
don su daɗa gina tsarin gina manhajojin da ke gudanar da tafiya a lokaci ɗaya. - For example, if you have five ads on your page, and each of them cause three synchronous loads, each with a 1 second latency connection, you’re in 15 seconds of load time just for JS loading. <> Misali, idan kana da tallace-tallace guda biya a shafinka, kuma kowane na haifar da lodin da ke tafiya a lokaci ɗaya sau uku, kowane na ɗaukar ɗakika ɗaya kafin haɗi, ka kasance ka kai daƙiƙoƙi 15 don kawai kana lodin JS.
- AMP pages allow third-party JavaScript but only in sandboxed iframes.
- By restricting them to iframes, they can’t block the execution of the main page.
- Even if they trigger multiple style re-calculations, their tiny iframes have very little DOM.
Pages in category "AMP"
The following 3 pages are in this category, out of 3 total.