/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function popup(url,ancho,alto,id,extras){ if(navigator.userAgent.indexOf("Mac")>0){ancho=parseInt(ancho)+15;alto=parseInt(alto)+15;} var left = (screen.availWidth-ancho)/2; var top = (screen.availHeight-alto)/2; if(extras!=""){extras=","+extras;}; var ventana = window.open(url,id,'width='+ancho+',height='+alto+',left='+left+',top='+top+',screenX='+left+',screenY='+top+extras); var bloqueado = "AVISO:\n\nPara ver este contenido es necesario que desactive\nel Bloqueo de Ventanas para este Sitio." //var bloqueado = "WARNING:\n\nIn order to use this functionality, you need\nto deactivate Popup Blocking." if(ventana==null || typeof(ventana.document)=="undefined"){ alert(bloqueado) }else{ return ventana; }; }