Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Czy można ominąć blokady okien pop-up w przeglądarkach?
PiotrN
post 16.03.2011, 17:30:00
Post #1





Grupa: Zarejestrowani
Postów: 73
Pomógł: 0
Dołączył: 8.05.2010

Ostrzeżenie: (0%)
-----


Witam.
Czy jest jakiś sposób na to, aby przeglądarki nie blokowały okna pop-up, które pokazuje się tylko 1 raz?
Kod z którego korzystam zamieszczam poniżej. Bardzo proszę o odpowiedź.

  1. <script language="javascript" type="text/javascript">
  2. <!--
  3. var win=null;
  4. function NewWindow(mypage,myname,w,h,pos,infocus){
  5. if(GetCookie("sid") == "999"){return;}
  6. document.cookie="sid=999; Path=/; Expires= " + getFuture(999);
  7. if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
  8. if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
  9. else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
  10. settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,r
    esizable=yes,fullscreen=yes";win=window.open(mypage,myname,settings);
  11. win.focus();}
  12. // Cookie functions borrowed from:
  13. // Ronnie Moore: Visit him at http://www.ronniemoore.com
  14. function getFuture(f){
  15. var d = new Date();
  16. d.setTime(d.getTime() + (86400000 * f));
  17. return d;
  18. }
  19.  
  20. function GetCookie (name) {
  21. var arg = name + "=";
  22. var alen = arg.length;
  23. var clen = document.cookie.length;
  24. var i = 0;
  25. while (i < clen) {
  26. var j = i + alen;
  27. if (document.cookie.substring(i, j) == arg)
  28. return getCookieVal (j);
  29. i = document.cookie.indexOf(" ", i) + 1;
  30. if (i == 0) break;
  31. }
  32. return null;
  33. }
  34.  
  35. function getCookieVal (offset) {
  36. var endstr = document.cookie.indexOf (";", offset);
  37. if (endstr == -1)
  38. endstr = document.cookie.length;
  39. return unescape(document.cookie.substring(offset, endstr));
  40. }
  41. // -->
  42.  
  43. <body onUnload="NewWindow('adres','tytuł','szerokość','wysokość','center','fullscreen','back');">


Ten post edytował PiotrN 16.03.2011, 17:36:35
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 18.07.2025 - 04:25