Quick / safe exit button | Community
Skip to main content
July 20, 2023
Solved

Quick / safe exit button

  • July 20, 2023
  • 2 replies
  • 826 views

We're wanting to put a floating quick/safe exit button on some pages so if the user clicks on them, it'll take them out of our site to a completely different one.

 

Has anyone done one before?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by krishna_sai

Hi @laurag not sure if I understood the requirement correctly. You can create a simple button component which extends core button and style according to your requirement. You can author this on which ever pages you want to show.

Hope this helps,
Krishna

2 replies

krishna_sai
Community Advisor
krishna_saiCommunity AdvisorAccepted solution
Community Advisor
July 20, 2023

Hi @laurag not sure if I understood the requirement correctly. You can create a simple button component which extends core button and style according to your requirement. You can author this on which ever pages you want to show.

Hope this helps,
Krishna

yuriy_shestakov
July 21, 2023

If your requirement is to inform a user that they leave the website, you can add the  "beforeunload" event listener into your main client library that will display the popup
(example here: https://dev.to/melvin2016/how-to-show-a-are-you-sure-to-leave-leave-site-etc-dialog-box-in-the-browser-before-the-user-leaves-using-javascript-30ia)

But in my sight, it could be safer to have another special redirect page with that message, the same way it is, for example, on LinkedIn. And you can use that redirect page for all external links. (The resulting links will be something like /content/<project>/redirect.html?path=<originalUrl>)

You even can use something like LinkRewriter service to update all external links to this behavior, in order to cover all the components + custom links from RichText component. Or use rewrite on dispatcher side, if you have AEM on-premise. However, custom components that use javascript redirection should be covered in their (FE) code anyway, so maybe the first approach with JS event is better though.