php - Javascript Open() does not work using Smarty -


i have module in whmcs has client side button which, when pressed needs open new page using javascript. not sure blocking it, when add {$download} value template shows correct link opened, , cannot find errors in console, nothing happens.

i have else statement run when button not clicked, , not echo when click it, press detected, new windows not open, kind of being ignored.

anybody have idea of might 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 opened                     win.focus();                 }else{                     //broswer has blocked                     alert('please allow popups download file.');                 }             }         </script>     {/literal} {else}     {$download} {/if} 

update:

i found reason code ignoring function. seems window.onload = function(){} causing issue, removing onload clause removed error.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -