Skip to content

Instantly share code, notes, and snippets.

@Johnbug
Created September 7, 2013 08:42
Show Gist options
  • Save Johnbug/6473949 to your computer and use it in GitHub Desktop.
Save Johnbug/6473949 to your computer and use it in GitHub Desktop.
XSS--UserAgent
/**
* Created with JetBrains WebStorm.
* User: jonbug
* Date: 13-9-7
* Time: 下午4:11
* To change this template use File | Settings | File Templates.
*/
function getUserAgent(){
if(window.ActiveXObject){
if(document.documentElement && typeof document.documentElement.style.maxHeight!="undefined"){
if(typeof document.adoptNode != "undefined"){
}
}
return "msie";
}
else if (typeof window.opera != "undefined"){
return "opera";
}
else if(typeof window.netscape != "undefined"){
if(typeof window.Iterator != "undefined"){
if(typeof document.styleSheets != "undefined"){
}
}
return "mozilla";
}
else if(typeof window.pageXOffset != "undefined"){
try{
if(typeof external.AddSearchProvider != "undefined"){
return "chrome";
}
}catch (e){
return "safari";
}
}
else {
return "unknown";
}
}
alert(getUserAgent());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment