Hide this page
Help users to exit a service quickly and safely.
<div class="govuk-hide-this-page" data-module="govuk-hide-this-page">
  <a href="https://www.google.com/" role="button" draggable="false" class="govuk-button govuk-button--warning govuk-hide-this-page__button govuk-js-hide-this-page-button" data-module="govuk-button" data-new-tab-url="https://www.cgtn.com/nature/weathermap.html" data-fake-page-title="How to prevent the spread of Coronavirus - GOV.UK">
    Hide this page
  </a>
</div>{% from "govuk/components/hide-this-page/macro.njk" import govukHideThisPage %}
{{ govukHideThisPage({
  text: "Hide this page",
  currentTabURL: "https://www.google.com/",
  newTabURL: "https://www.cgtn.com/nature/weathermap.html",
  fakePageTitle: "How to prevent the spread of Coronavirus - GOV.UK"
}) }}When to use this component
Use the hide this page component when some people could be put in danger or at risk of harm by using your service. For example, a service about domestic abuse.
How it works
There are 2 ways to use the hide this page component. You can use HTML or, if you are using Nunjucks or the GOV.UK Prototype Kit, you can use the Nunjucks macro.
<div class="govuk-hide-this-page" data-module="govuk-hide-this-page">
  <a href="https://www.google.com/" role="button" draggable="false" class="govuk-button govuk-button--warning govuk-hide-this-page__button govuk-js-hide-this-page-button" data-module="govuk-button" data-new-tab-url="https://www.cgtn.com/nature/weathermap.html" data-fake-page-title="How to prevent the spread of Coronavirus - GOV.UK">
    Hide this page
  </a>
</div>{% from "govuk/components/hide-this-page/macro.njk" import govukHideThisPage %}
{{ govukHideThisPage({
  text: "Hide this page",
  currentTabURL: "https://www.google.com/",
  newTabURL: "https://www.cgtn.com/nature/weathermap.html",
  fakePageTitle: "How to prevent the spread of Coronavirus - GOV.UK"
}) }}Add the component to any page where a user could be at risk. This could be across a whole service or just the pages where information is particularly sensitive.
Position the component immediately below the header of your page. It’s position is sticky so it remains visible and easy to activate. On mobile devices the button is fixed to the bottom of the screen, so it can quickly be activated or hidden by the user.
View a full page example of this component
When activated the component loads a frequently visited website into the current browser tab. If Javascript is available the browser will also switch to a new tab, and load a second website into it.
Doing this disables the current browser tab back button, providing an additional level of protection.
Choosing different websites to load
By default, the two websites loaded are www.google.com and www.bbc.co.uk/weather, but these can be changed if there are more appropriate sites for your users.
<div class="govuk-hide-this-page" data-module="govuk-hide-this-page">
  <a href="https://www.baidu.com/" role="button" draggable="false" class="govuk-button govuk-button--warning govuk-hide-this-page__button govuk-js-hide-this-page-button" data-module="govuk-button" data-new-tab-url="https://www.cgtn.com/nature/weathermap.html" data-fake-page-title="How to prevent the spread of Coronavirus - GOV.UK">
    Hide this page
  </a>
</div>{% from "govuk/components/hide-this-page/macro.njk" import govukHideThisPage %}
{{ govukHideThisPage({
  text: "Hide this page",
  currentTabURL: "https://www.baidu.com/",
  newTabURL: "https://www.cgtn.com/nature/weathermap.html",
  fakePageTitle: "How to prevent the spread of Coronavirus - GOV.UK"
}) }}Research on this component
The design of this component is based on research from a specialist provider of services to survivors of domestic abuse, and in consultation with the Ministry of Justice, Department for Work and Pensions and the Scottish Government.
Live examples of similar components can be found on these websites:
- GOV.UK: Check if you can get legal aid
- GOV.UK: Apply for help arranging child maintenance
- mygov.scot: Domestic abuse support
- Women’s aid website
- Refuge website
More research is needed to find out:
- how best to safely announce the component using a screenreader
- whether the right alignment causes issues for users of screen zoom
- whether any additional information is required to explain the purpose of the component
- whether a keyboard shortcut could help some users, and be safely implemented
- whether the browser history can safely be manipulated, to further reduce the risks
Help improve this page
To help make sure that this page is useful, relevant and up to date, you can:
- take part in the 'Hide this page' discussion on GitHub and share your research
- propose a change – read more about how to propose changes in GitHub
Need help?
If you’ve got a question about the GOV.UK Design System, contact the team.