Created
August 29, 2012 14:16
-
-
Save thefella/3513221 to your computer and use it in GitHub Desktop.
Detect if browser request is a prefetch or prerender using PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( (isset($_SERVER["HTTP_X_PURPOSE"]) and (strtolower($_SERVER["HTTP_X_PURPOSE"]) == "preview")) or | |
(isset($_SERVER["HTTP_X_MOZ"]) and (strtolower($_SERVER["HTTP_X_MOZ"]) == "prefetch")) ) { | |
// Request is a prerender or prefetch | |
} else { | |
// Request is 'normal' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment