Skip to content

Commit

Permalink
Merge pull request #248 from alphagov/ensure_js_status
Browse files Browse the repository at this point in the history
Degrade gracefully when external JS can’t be loaded
  • Loading branch information
gemmaleigh committed Sep 12, 2016
2 parents cde9158 + 4b0afef commit 94c0f7f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/views/layouts/govuk_template.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,8 @@
<script src="<%= asset_path "govuk-template.js" %>"></script>

<%= yield :body_end %>
<%# if no GOVUK-namespaced module has loaded we can assume JS has failed and remove the class %>
<script>if (typeof window.GOVUK === 'undefined') document.body.className = document.body.className.replace('js-enabled', '');</script>
</body>
</html>

0 comments on commit 94c0f7f

Please sign in to comment.