0

I'm attempting to return a pop-up warning for users who click an external link on my site. The issue is, the functionality must still be there if JS is disabled. I think this would leave PHP as my only option, so would this be accomplished with a custom plugin? I've seen sites accomplish something similar with a separate redirect php include with the link destination in a query string. My experience developing Craft plugins is virtually nil so forgive my ignorance- but would that look like a plugin that finds and rewrites all the external links' hrefs on the existing page, returns the html for the modal (appends a fullscreen div to the dom), and populates a "continue to external link" anchor based on the original link in the query string? Am I on the right track here?

Thank you!

1
  • 1
    Pretty sure this is impossible (per my answer below)... If you think you've seen this done on other sites, please add a link to them so we can backwards-engineer it.
    – Lindsey D
    Sep 10 '15 at 21:53
4

A modal cannot exist without JS... no matter how it is triggered.

At best, you'd have the user navigate to an intermediate page, with "Forward" and "Back" buttons. That being said, the UX sounds pretty terrible in that case.

You're actually dealing with conflicting requirements:

  • Must warn people before leaving site.
  • Must be non-JS compatible.

Those two requirements will never really be in harmony.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.