JAVASCRIPT 29
Click2sms.js Guest on 19th April 2021 08:01:23 PM
  1.  
  2. var isMobile = 0;
  3.  
  4. var getUrlParameter = function getUrlParameter(sParam) {
  5.     var sPageURL = decodeURIComponent(window.location.search.substring(1)),
  6.         sURLVariables = sPageURL.split('&'),
  7.         sParameterName,
  8.         i;
  9.  
  10.     for (i = 0; i < sURLVariables.length; i++) {
  11.         sParameterName = sURLVariables[i].split('=');
  12.  
  13.         if (sParameterName[0] === sParam) {
  14.             return sParameterName[1] === undefined ? true : sParameterName[1];
  15.         }
  16.     }
  17. };
  18.  
  19. function getDevice() {
  20.     isMobile = {
  21.         Android: function() {
  22.             return navigator.userAgent.match(/Android/i);
  23.         },
  24.         BlackBerry: function() {
  25.             return navigator.userAgent.match(/BlackBerry/i);
  26.         },
  27.         iOS: function() {
  28.             return navigator.userAgent.match(/iPhone|iPad|iPod/i);
  29.         },
  30.         iPhone: function() {
  31.             return navigator.userAgent.match(/iPhone/i);
  32.         },
  33.         iPad: function() {
  34.             return navigator.userAgent.match(/iPad/i);
  35.         },
  36.         Opera: function() {
  37.             return navigator.userAgent.match(/Opera Mini/i);
  38.         },
  39.         Windows: function() {
  40.             return navigator.userAgent.match(/IEMobile/i);
  41.         },
  42.         any: function() {
  43.             return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
  44.         }
  45.     };
  46. };

Paste-bin is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.