Skip to content

Instantly share code, notes, and snippets.

@mvance
Created May 18, 2011 01:38
Show Gist options
  • Save mvance/977836 to your computer and use it in GitHub Desktop.
Save mvance/977836 to your computer and use it in GitHub Desktop.
A bookmarklet to determine whether a website is running Drupal, Pressflow, or something else.
javascript:
(function(){
/*@author Matt Vance (borrowing heavily from Pablo Cantero's pageChangesNotifier.js - https://gist.github.com/751586) */
var xmlHttp=getXMLHttpObj();
if(xmlHttp==null){
alert('Failed to load XMLHTTP');
return;
}
var actual=getPageContent(xmlHttp,window.location.href);
switch(actual){
case'Sun, 19 Nov 1978 05:00:00 GMT':alert('Drupal');
break;
case'Sun, 11 Mar 1984 12:00:00 GMT':alert('Pressflow');
break;
default:alert('Other (Datestamp = "'+actual+'")');
}
function getPageContent(xmlHttp,url){
xmlHttp.open('GET',window.location.href,false);
xmlHttp.send('');
return xmlHttp.getResponseHeader("Expires");
}
function getXMLHttpObj(){
if(typeof(XMLHttpRequest)!='undefined')
return new XMLHttpRequest();
var axO=['Msxml2.XMLHTTP.6.0','Msxml2.XMLHTTP.4.0','Msxml2.XMLHTTP.3.0','Msxml2.XMLHTTP','Microsoft.XMLHTTP'];
for(var i=0;i<axO.length;i++){
try{
return new ActiveXObject(axO[i]);
}
catch(e){
}
}
return null;
}
}
)()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment