<p><strong>A modal cannot exist without JS... no matter how it is triggered.</strong></p>

<p>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.</p>

<p>You're actually dealing with conflicting requirements:</p>

<ul>
<li>Must warn people before leaving site.</li>
<li>Must be non-JS compatible.</li>
</ul>

<p>Those two requirements will never really be in harmony.</p>

CC BY-SA 3.0
2015-09-10T21:51:36.560Z
2015-09-10T21:51:36.560Z
Lindsey D
<p>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?</p>

<p>Thank you!</p>

CC BY-SA 3.0
2015-09-10T21:53:25.800Z
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
<plugin-development><plugins><php>
Creating a modal warning for an external link?
# Creating a modal warning for an external link?

(Asked by: username_0 on 2015-09-10)

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!

**Tags:** plugin-development, plugins, php
> **Comments:**
> **username_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.  

---

## 1 answers

### Answer by username_1 on 2015-09-10. Score: 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.


---

