Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <script>
- var isChrome = false;
- var isBrowser = false;
- var isApp = false;
- var agent = navigator.userAgent;
- if(isTextPresent(agent, "Chrome")){
- isChrome=true;
- alert("Chrome " + isChrome);
- if(isTextPresent(agent, "Browser")){
- isBrowser=true;
- alert("Browser" + isBrowser);
- } else {
- isApp =true;
- alert("App " + isApp);
- }
- }
- function isTextPresent (agent, text) {
- if (agent.indexOf(text) > -1){
- return true;
- } else {
- return false;
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement