Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

chore(docs-app): remove document.write() from docs index.html #17035

Merged
merged 1 commit into from
May 25, 2020

Conversation

gkalpak
Copy link
Member

@gkalpak gkalpak commented May 24, 2020

Previously, the docs app used document.write(), causing the following warning on Chrome:

A parser-blocking, cross site (i.e. different eTLD+1) script,
https://ajax.googleapis.com/ajax/libs/angularjs/1.7.9/angular.min.js, is
invoked via document.write. The network request for this script MAY be
blocked by the browser in this or a future page load due to poor network
connectivity.

In the past, document.write() seems to have been used in order for browsers (such as Firefox) to work correctly with our dynamically set <base> tag and relative style/script URLs.

This commit replaces document.write() with regular <style>/<script> tabs to avoid the warning (and potential issues due to poor network connectivity). It seems that the latest versions of Chrome, Firefox and IE can handle this fine (without naticeable delays).

Fixes #15396.

Previously, the docs app used `document.write()`, causing the following
warning on Chrome:

```
A parser-blocking, cross site (i.e. different eTLD+1) script,
https://ajax.googleapis.com/ajax/libs/angularjs/1.7.9/angular.min.js, is
invoked via document.write. The network request for this script MAY be
blocked by the browser in this or a future page load due to poor network
connectivity.
```

In the past, `document.write()` seems to have been used in order for
browsers (such as Firefox) to work correctly with our dynamically set
`<base>` tag and relative style/script URLs.

This commit replaces `document.write()` with regular
`<style>`/`<script>` tabs to avoid the warning (and potential issues due
to poor network connectivity). It seems that the latest versions of
Chrome, Firefox and IE can handle this fine (without naticeable delays).

Fixes angular#15396
@gkalpak gkalpak marked this pull request as ready for review May 25, 2020 08:12
@petebacondarwin petebacondarwin merged commit a31c207 into angular:master May 25, 2020
@gkalpak gkalpak deleted the fix-remove-document-write branch May 25, 2020 16:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix(docs-app): get rid of document.write for inserting scripts
4 participants