URL Proxy Delay

From Roaring Penguin
Jump to: navigation, search

CanIt versions 9.1.2 and newer offer the feature Rules->URL Proxy. This feature is useful to protect users from accidentally following malicious links. The landing page provides information on where the link actually points and then allows the user to click through if they feel safe.

We received a feature request to add a delay so that users cannot click through without a couple of seconds to think about what they are clicking on. While we do not plan on implementing this feature directly, it can be achieved using Setup->Templates. This page allows you to change the content of pretty much any pre-authentication page of the WebUI, including the URL Proxy landing page. It is configurable per-realm because we automatically append "rlm=realmname" to the end of all links that we send out. This allows us to pull in theme customizations and other changes without the user needing to log in.

You can add a delay by covering the link for a certain period. For example, place this at the very top of the "HTML content for anti-phishing URL Redirection page" box:

        var delay=5;
        var counter=setInterval(count, 1000)
        function count() {
            if (delay <= 0) {
                document.getElementById("shade").style.display = 'none';
            } else {
            document.getElementById("shade").innerHTML="Link available in: " + delay + "s...";

Then, further down replace:

    <p><a href="%{urlproxy_url}">I understand and wish to follow the link.</a></p>


    <span class="field" style="position:relative">
        <a href="%{urlproxy_url}">I understand and wish to follow the link.</a>
        <div id="shade" style="text-align: center;width: 100%; height: 100%; background-color: #000; position:absolute;top: 0px;color: #fff;"></div>

This will create a shade over the link for the number of seconds defined by "var delay=" in the first box. The shade will count down that number of seconds then disappear to reveal the link.

You could also set a "meta" tag to automatically follow the link after some number of seconds, but we do not encourage that, so we will not discuss it here.