Q: Javascript Open() does not work using Smarty I have a module in WHMCS which has a client side button which, when pressed needs to open a new page using javascript.
I am not sure what would be blocking it, but when I add the {$download} value to the template it shows the correct link to be opened, and I cannot find errors in the console, but nothing happens.
I have a else statement which does run when the button is not clicked, and does not echo when i do click it, so the press is detected, the new windows just does not open, kind of like it is being ignored.
Anybody have an idea of what might be causing this?
{if $download != '-1'}
    {literal}
        <script type="text/javascript">        
            window.onload = function(){
                var win = window.open('{/literal}{$download}{literal}', '_blank');
                if(win){
                    //Browser has allowed it to be opened
                    win.focus();
                }else{
                    //Broswer has blocked it
                    alert('Please allow popups to download this file.');
                }
            }
        </script>
    {/literal}
{else}
    {$download}
{/if}

UPDATE:
I found the reason the code was ignoring the function. It seems the window.onload = function(){} was causing the issue, removing the onload clause removed the error.
