Skip to content

Commit cf3f86d

Browse files
Update JavaScript support code snippet
1 parent 64a1c3c commit cf3f86d

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

docs/installation/installing-compiled.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ If you require any of this functionality, you should [install using npm](/docs/i
4949
Add the following JavaScript to the top of the `<body>` section of your page template:
5050

5151
```html
52-
<script>document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');</script>
52+
<script>document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' nhsuk-frontend-supported' : '');</script>
5353
```
5454

5555
4. Create pages using NHS.UK frontend

docs/installation/installing-with-npm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ You should include NHS.UK frontend JavaScript in your project to ensure that all
6161
Add the following JavaScript to the top of the `<body>` section of your page template:
6262

6363
```js
64-
document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');
64+
<script>document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' nhsuk-frontend-supported' : '');</script>
6565
```
6666

6767
### Option 1: Include compiled JavaScript

packages/template.njk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
</head>
2929

3030
<body {% if bodyClasses %}class="{{ bodyClasses }}"{% endif %} {{- nhsukAttributes(bodyAttributes) }}>
31-
<script>document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');</script>
31+
<script>document.body.className += ' js-enabled' + ('noModule' in HTMLScriptElement.prototype ? ' nhsuk-frontend-supported' : '');</script>
3232
{% block bodyStart %}{% endblock %}
3333

3434
{% block skipLink %}

0 commit comments

Comments
 (0)