Created
September 7, 2013 08:42
-
-
Save Johnbug/6473949 to your computer and use it in GitHub Desktop.
XSS--UserAgent
This file contains hidden or 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
| /** | |
| * 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