Posted By

cochambre on 07/12/06


Tagged

window popup open new blocking


Versions (?)

Who likes this?

26 people have marked this snippet as a favorite

jonhenshaw
xaviaracil
mate
panatlantica
nicolaspar
nutella
fael
vali29
heinz1959
visuallyspun
SpinZ
gAmUssA
jeradhill
jamesming
hans
rubensarrio
Skeyelab
profpatsy
ckayra
masondixon
bobbym245
seanpowell
michellebracken
jondiscipulo
ArnoldDC
yoitsben


Javascript Popup with Blocking detection


 / Published in: JavaScript
 

  1. function popup(url,ancho,alto,id,extras){
  2. if(navigator.userAgent.indexOf("Mac")>0){ancho=parseInt(ancho)+15;alto=parseInt(alto)+15;}
  3. var left = (screen.availWidth-ancho)/2;
  4. var top = (screen.availHeight-alto)/2;
  5. if(extras!=""){extras=","+extras;};
  6. var ventana = window.open(url,id,'width='+ancho+',height='+alto+',left='+left+',top='+top+',screenX='+left+',screenY='+top+extras);
  7. var bloqueado = "AVISO:\n\nPara ver este contenido es necesario que desactive\nel Bloqueo de Ventanas para este Sitio."
  8. //var bloqueado = "WARNING:\n\nIn order to use this functionality, you need\nto deactivate Popup Blocking."
  9. if(ventana==null || typeof(ventana.document)=="undefined"){ alert(bloqueado) }else{ return ventana; };
  10. }

Report this snippet  

You need to login to post a comment.