Subscribe to RSS feed RSS-Feed abonnieren or oder follow me Follow me on Twitter? auf Twitter?
Last week, we shared JavaScript and PHP code snippets to In der vergangenen Woche, teilten wir JavaScript und PHP-Code-Schnipsel zu block DiggBar Block DiggBar . . While they served the purpose fairly well, each had its own flaws. Während sie den Zweck erfüllt, ziemlich gut, hatte jeder seine eigenen Fehler.
Here is a new, improved method that puts two and two together – by combining the PHP and JavaScript code to get the best of both worlds. Hier ist eine neue, verbesserte Methode, die zwei und zwei zusammen bringt - durch die Kombination der PHP-und JavaScript-Code, um das Beste aus beiden Welten. The PHP method provided would display a message and stop rendering the page, whereas the JavaScript code would remove all frames – including Google Images. Die PHP-Methode zur Verfügung gestellt würde eine Meldung angezeigt, und beenden das Rendering der Seite, während die JavaScript-Code werden alle Frames - einschließlich Google Images entfallen würde. This means that visitors who see the image from, say archive pages, would not have a link to click through to the actual page. Dies bedeutet, dass die Besucher sehen, wer das Bild aus, sagen Archiv-Seiten, hätte nicht einen Link zu klicken, um die aktuelle Seite.
So, I combined the two so that the below code checks whether the visitor is viewing a Digg shortened URL (typical of DiggBar), and if so, serves some JavaScript to redirect the user to the original web page. Also verband ich die beiden so dass die unten stehenden Code überprüft, ob der Besucher der Anzeige eines Digg verkürzte URL (typisch für DiggBar), und wenn ja, serviert einige JavaScript, um es dem Benutzer, die Original-Webseite umzuleiten. This method can be used not just in WordPress, but in any CMS/app that supports PHP. Mit dieser Methode kann nicht nur in WordPress werden, aber auf jeden CMS / app, die PHP unterstützt.
<?php if (preg_match('#http://digg.com/\w{1,8}/?$#', <? php if (preg_match ( '# http://digg.com/ \ w (1,8 }/?$#',
$_SERVER['HTTP_REFERER']) ) { ?> $ _SERVER [ 'HTTP_REFERER'])) (?>
<script language="JavaScript" type="text/javascript"> <script language="JavaScript" type="text/javascript">
if (top.location != self.location) top.location.replace(self.location); if (top.location! = self.location) top.location.replace (self.location);
</script> </ script>
<?php <? php
exit; exit;
} )
?> ?>
And by the way, even Engadget, a gadget blog that hits Digg on a regular basis, has Und übrigens, auch Engadget, ein Gadget Blog, dass die Zugriffe auf ein regelmäßig Digg, hat blocked Digg Bar blockiert Digg Bar . . If a top publisher should block the DiggBar, I hope Digg realizes DiggBar's problems and does some serious thinking over it. Wenn ein Top-Publisher der DiggBar Block sollte, hoffe ich, Digg realisiert DiggBar Probleme und hat einige ernsthafte Gedanken darüber.
Related reading In Verbindung stehende Lesung
- How to remove DiggBar (Greasemonkey script) Windows XP DiggBar (Greasemonkey-Skript)
- JavaScript and PHP codes to remove DiggBar JavaScript und PHP-Codes zu entfernen DiggBar
- DiggBar Remover removes DiggBar the smart way DiggBar Remover entfernt DiggBar die clevere Art
- How to block popups and ads in Google Chrome Wie Pop-ups und Blockieren von Anzeigen in Google Chrome