in the configuration file.
It defers this by changing the
<script> elements on the HTML page to
It also adds a new
type attribute whose value is set
window.onload handler is
added to the HTML, which executes all the deferred scripts.
script tag if it has
pagespeed_no_defer attribute. This is useful when a
script tag needs to be executed while loading the page.
For example, a
script tag may be updating the main content
dynamically as a slideshow of images in the visible content of the page.
Parent variables accessed from an
iframe may be
parallel as much as possible.
document.write fail in cases where they span multiple
An example is:
<script>document.write('<div>')</script> <span></span> <script>document.write('</div>')</script>Without
spanwould have been created inside the
spanwould have been created outside and after the
document.body.appendChild calls will always get appended to
the bottom of the page.
safari5+, Firefox3.6+ and IE9+. For other user agents the filter is turned
of the DOM may behave differently when
completely, such scripts will behave differently with
alert is placed
at the start of the page, then with
alert would appear only after the page is loaded completely.
User actions that trigger events such as
onkeypress will not be handled until the page is rendered
pagespeed_no_defer attribute can change the order of script
execution because those scripts using it are executed inline while those not
using are deferred. This can cause errors if these scripts depend on each other
in any way.