Skip to main content

Posts

Showing posts from November, 2016

small code snippet to get Youtube video views from URL using Javascript

<div>     <input type="url" placeholder="Enter Youtube video URL">     <a href="#" onClick="videoViews()">GO</a>  </div> <div class="videoembed"></div> <div class="views"></div> -------------------------------------------------- function videoViews() {     var rex = /[a-zA-Z0-9\-\_]{11}/,         videoUrl = $('input').val() === '' ? alert('Enter a valid Url'):$('input').val(),         videoId = videoUrl.match(rex),         jsonUrl = 'http://gdata.youtube.com/feeds/api/videos/' + videoId + '?v=2&alt=json',        embedUrl = '//www.youtube.com/embed/' + videoId,        embedCode = '<iframe width="350" height="197" src="' + embedUrl + '" frameborder="0" allowfullscreen></iframe>'             //Get Views from JSON     $.getJSON(jsonUrl, function (

How to find the browser details using JavaScript

 Getting about OS, Browser, Mobile, Flash, Cookies, Screen Size and Full User Agent. /**  * JavaScript Client Detection  * (C) viazenetti GmbH (Christian Ludwig)  */ (function (window) {     {         var unknown = '-';         // screen         var screenSize = '';         if (screen.width) {             width = (screen.width) ? screen.width : '';             height = (screen.height) ? screen.height : '';             screenSize += '' + width + " x " + height;         }         // browser         var nVer = navigator.appVersion;         var nAgt = navigator.userAgent;         var browser = navigator.appName;         var version = '' + parseFloat(navigator.appVersion);         var majorVersion = parseInt(navigator.appVersion, 10);         var nameOffset, verOffset, ix;         // Opera         if ((verOffset = nAgt.indexOf('Opera')) != -1) {             browser = 'Opera';             version = nAgt.substring(ve