Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [JavaScript]blokowanie adblocka
Rilekt
post 26.11.2014, 19:24:01
Post #1





Grupa: Zarejestrowani
Postów: 36
Pomógł: 0
Dołączył: 14.03.2013

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


Witajcie,
poszukuję spryptu który będzie wykrywał czy ten kto wejdzie na mają stronę ma Adblocka, a jeśli tak to niech wyświetli popup'a że należy go wyłączyć i nie bedzie mógł przeglądać strony. Ktoś coś takiego może znalazł?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 7)
trueblue
post 26.11.2014, 19:27:48
Post #2





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

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


http://w3guy.com/detecting-adblock/


--------------------
Go to the top of the page
+Quote Post
Rilekt
post 26.11.2014, 19:56:40
Post #3





Grupa: Zarejestrowani
Postów: 36
Pomógł: 0
Dołączył: 14.03.2013

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


Cytat(trueblue @ 26.11.2014, 19:27:48 ) *

Dziękuję, użyłem JavaScriptu jednak tekst się wyświetla za każdym razem, czy mam włączonego adblocka czy nie..
index.html po sekwencji body
  1. <script type="text/javascript" src="advert.js"></script>
  2. <script type="text/javascript">
  3. if (document.getElementById("tester") == undefined)
  4. {
  5. document.write(" Wyłącz dodatek AdBlock aby móc się zarejestrować w serwisie!");
  6. }
  7. </script>


i

advert.js (podejrzewam ze w nim jest cos nie tak

  1. div id="tester" style="display:none"><iframe style='float: center; border: 0; width: 400px; height: 455px;' scrolling='no' src='http://zalogowany.pl/iframe?ref=2080e148&bg=color&bg-color=FFFFFF&title= &under_title= &color=1CEE8A&button=Dalej&type=small'></iframe></div>');
Go to the top of the page
+Quote Post
trueblue
post 26.11.2014, 20:07:24
Post #4





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

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


Czy to na pewno Twój cały adverts.js?


--------------------
Go to the top of the page
+Quote Post
Rilekt
post 26.11.2014, 20:24:06
Post #5





Grupa: Zarejestrowani
Postów: 36
Pomógł: 0
Dołączył: 14.03.2013

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


Cytat(trueblue @ 26.11.2014, 20:07:24 ) *
Czy to na pewno Twój cały adverts.js?

O taki dokładnie (poprawiony) ale nadal nie działa:
<div id="tester" style="display:none"><iframe style='float: center; border: 0; width: 400px; height: 455px;' scrolling='no' src='http://zalogowany.pl/iframe?ref=2080e148&bg=color&bg-color=FFFFFF&title= &under_title= &color=1CEE8A&button=Dalej&type=small'></iframe></div>');
Go to the top of the page
+Quote Post
trueblue
post 26.11.2014, 20:26:59
Post #6





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

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


  1. document.write('<div id="tester" style="display:none"><iframe style="float: center; border: 0; width: 400px; height: 455px;" scrolling="no" src="http://zalogowany.pl/iframe?ref=2080e148&bg=color&bg-color=FFFFFF&title= &under_title= &color=1CEE8A&button=Dalej&type=small"></iframe></div>');



--------------------
Go to the top of the page
+Quote Post
Rilekt
post 26.11.2014, 20:37:19
Post #7





Grupa: Zarejestrowani
Postów: 36
Pomógł: 0
Dołączył: 14.03.2013

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


Cytat(trueblue @ 26.11.2014, 20:26:59 ) *
  1. document.write('<div id="tester" style="display:none"><iframe style="float: center; border: 0; width: 400px; height: 455px;" scrolling="no" src="http://zalogowany.pl/iframe?ref=2080e148&bg=color&bg-color=FFFFFF&title= &under_title= &color=1CEE8A&button=Dalej&type=small"></iframe></div>');


Nie nie.. to chyba nie tak ma działać.

Może ja Ci podeślę całą sekwencję index.html
  1. <!--okno popup-->
  2. <div id="sub21">
  3. <p algin="left"><input class="textbox"type="text"> &nbsp; &ensp; <b>Twój nick</b></p>
  4. <iframe style="float: center; border: 0; width: 400px; height: 455px;" scrolling="no" src="http://zalogowany.pl/iframe?ref=2080e148&bg=color&bg-color=FFFFFF&title= &under_title= &color=1CEE8A&button=Dalej&type=small"></iframe></div>
  5. </div>


AdBlock blokuje całego Iframe'a, więc (jeżeli ktoś ma włączonego adblocka) chce zamiast niego wstawić informację, aby go wyłączyć.
A jeśli nie ma włączonego to niech sie poprostu wyświetla iframe bez powiadomienia.
Go to the top of the page
+Quote Post
trueblue
post 26.11.2014, 20:40:26
Post #8





Grupa: Zarejestrowani
Postów: 6 806
Pomógł: 1828
Dołączył: 11.03.2014

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


Jeżeli AdBlock zablokował Twojego testowego iframe, to możesz wstawić informację, ale nie w iframe (podejrzewam, że może to być iframe, ale ze źródłem w tej samej domenie - nie wiem jak dokładnie działa AdBlock).
Musisz użyć innego sposobu.


--------------------
Go to the top of the page
+Quote Post

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: 14.08.2025 - 01:55