Skip to content

Instantly share code, notes, and snippets.

@reyramos
Created June 13, 2014 14:48
Show Gist options
  • Select an option

  • Save reyramos/65b8ad1d05eb476d41f7 to your computer and use it in GitHub Desktop.

Select an option

Save reyramos/65b8ad1d05eb476d41f7 to your computer and use it in GitHub Desktop.
script to detect IOS devices to run jsconsole, BECAREFUL do not load this on production
(function(window){
var key = "ee0256032e288b780f41513765b59254";
var ua = window.navigator ? window.navigator.userAgent :
window.request ? window.request.headers['user-agent'] : 'No User Agent'
var isMobile = {
Android: function () {
return ua.match(/Android/i);
}
, iOS: function () {
return ua.match(/iPhone|iPad|iPod/i);
}
};
if(isMobile.iOS()){
var jc = document.createElement('script'); jc.type = 'text/javascript'; jc.async = true;
jc.src = 'http://jsconsole.com/remote.js?'+key;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(jc, s);
}
})(window)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment