Forum Discussion

rafaelbn's avatar
rafaelbn
Icon for Cirrostratus rankCirrostratus
Jun 17, 2019

APM Policy to auto-connect VPN and then open webtop

Hello Devs!

 

I'm trying to design a policy that a client would auto connect to the VPN and the webtop, with the internal apps links, did not have the VPN link. Let me show an image:

 

 

I was able to configure the auto-connect part, but the "Corporate VPN" link is still showing on the webtop. I wish it was gone/hidden.

 

My policy is as follows:

 

 

This policy is type SSL-VPN. I tested as type "All" and with this configuration:

 

 

The configuration inside the "landing page" is as follows:

 

 

 

Any thoughts? I just want to auto-connect on the VPN and show only the "Portal Green" icon. Corporate VPN should be hidden (or not even there).

 

Thanks! Rafael

1 Reply

  • Hi Rafael,

     

    You can use the APM Advanced Customization to make the '/Common/vpn-network-resource' button on your website to be hidden. To achieve this add the following javascript code to the footer.inc file of your access policy.

     

    I've tested this code with version 14.1.0.3.

     

    <script>
    if (window.location.href.indexOf('vdesk/webtop.eui?webtop') > 0 ) {
        document.getElementById("webtop_favorites_inner_container2").style.display = "none";
        document.addEventListener('readystatechange', event => {
        
            const sleep = (milliseconds) => {
                return new Promise(resolve => setTimeout(resolve, milliseconds))
            }
       
            if (event.target.readyState === "interactive") {      //same as:  document.addEventListener("DOMContentLoaded"...   // same as  jQuery.ready
                //alert("All HTML DOM elements are accessible");
            }
       
            if (event.target.readyState === "complete") {
                //alert("Now external resources are loaded too, like css,src etc... ");
                sleep(500).then(() => {
                    document.getElementById('/Common/vpn-network-resource').style.display = 'none';
                    document.getElementById("webtop_favorites_inner_container2").style.display = "block";
                })
            }
       
        });
    }
    </script>