Aprire finestra popup con Safari

  • Creatore Discussione Creatore Discussione Shyson
  • Data di inizio Data di inizio

Shyson

Utente Attivo
19 Ago 2012
1.179
1
38
Questo codice mi apre il popup con Chrome, Firefox e Opera, con Safari apre la finestra grande come il monitor.

PHP:
function guest() {
  var w = 800;
  var h = 600;
  var l = Math.floor((screen.width-w)/2);
  var t = Math.floor((screen.height-h)/2);
  window.open("guestbook/formG.php","","width=" + w + ",height=" + h + ",top=" + t + ",left=" + l);
}
 
Ciao, usa gli apici singoli per racchiudere tutte le opzioni
 
Anche a mettere così non cambia niente

PHP:
function guest() { 
  var w = 800;
  var h = 600;
  var l = Math.floor((screen.width-w)/2);
  var t = Math.floor((screen.height-h)/2);
  window.open('guestbook/formG.php',' ','width=' + w + ',height=' + h + ',top=' + t + ',left=' + l);
}
 
sicuro di riuscire a recuperare screen.width fai un alert di l vedi se è corretta
 
Non so come si fa, ma se funziona con tutti i browser (meno safari) vuol dire che va bene.
 
Ultima modifica:
scrivi alert(l)
non è detto magari safari vuole la sintassi completa
window.screen.width
non l'ho mai usato quindi sto andando a tentativi
 
Ho messo così ma non apre il gustbook

PHP:
function guest() { 
  var w = 800;
  var h = 600;
  var l = Math.floor((screen.width-w)/2);
  var t = Math.floor((screen.height-h)/2);
  window.open('guestbook/formG.php',' ','width=' + w + ',height=' + h + ',top=' + t + ',left=' + l);
  alert(l)
}
 

Discussioni simili