Autocomplete Text Input for HTML5

George John
Updated on 25-Jun-2020 06:38:21

426 Views

Use the autocomplete attribute for autocomplete text input. The autocomplete attribute is used with a form elements to set the autocomplete feature on or off. If the autocomplete feature is on, the browser will automatically show values, based on what users entered before in the field.If the autocomplete feature is off, the browser won’t automatically show values, based on what users entered before in the field.The following are the attribute values −S. NoAttribute ValueDescription1onThis is the default value. The browser automatically complete values based on what users entered before.2offThe browser won’t complete values based on what users entered before. Users have to ... Read More

HTML5 Canvas Circle Text

Ankith Reddy
Updated on 25-Jun-2020 06:37:12

588 Views

To create a text inside circles in canvas, use the −context.beginPath();ExampleThe following is the canvas −$("#demo").on("click", "#canvas1", function(event) {    var canvas = document.getElementById('canvas1');       if (canvas.getContext) {          var context = canvas.getContext("2d");          var w = 25;          var x = event.pageX;          var y = Math.floor(event.pageY-$(this).offset().top);                    context.beginPath();          context.fillStyle = "blue";          context.arc(x, y, w/2, 0, 2 * Math.PI, false);          context.fill();          context = canvas.getContext("2d");          context.font = '9pt';          context.fillStyle = 'white';          context.textAlign = 'center';          context.fillText('amit', x, y+4);       } });HTML    

HTML5 Canvas Transformation Matrix

Samual Sam
Updated on 25-Jun-2020 06:35:48

570 Views

HTML5 canvas provides methods that allow modifications directly to the transformation matrix. The transformation matrix must initially be the identity transform. It may then be adjusted using the transformation methods.The transform (m11, m12, m21, m22, dx, dy) method must multiply the current transformation matrix with the matrix described by −m11 m21 dx m12 m22 dy  0   0  1The setTransform(m11, m12, m21, m22, dx, dy) method must reset the current transform to the identity matrix, and then invoke the transform(m11, m12, m21, m22, dx, dy) method with the same arguments.                   ... Read More

Avoid Repeat Reloading of HTML Video on the Same Page

Nancy Den
Updated on 25-Jun-2020 06:34:54

869 Views

Use preload = ”auto” to avoid repeat reloading of HTML video on the same page −                                        Your browser does not support the video tag.          

Use Web Workers in HTML5

karthikeya Boyini
Updated on 25-Jun-2020 06:33:56

184 Views

Web Workers allow for long-running scripts that are not interrupted by scripts that respond to clicks or other user interactions and allows long tasks to be executed without yielding to keep the page responsive.Web Workers are background scripts and they are relatively heavyweight and are not intended to be used in large numbers. For example, it would be inappropriate to launch one worker for each pixel of a four-megapixel image.Web Workers initialized with the URL of a JavaScript file, which contains the code the worker will execute. This code sets event listeners and communicates with the script that spawned it ... Read More

Track Pages in a Single Page Application with Google Analytics

Nancy Den
Updated on 25-Jun-2020 06:26:49

257 Views

A Single Page Application (SPA) loads the resources required to navigate throughout the site. This is for the first page load and SPA is a web application or website.The content loads dynamically when your site’s link is clicked and the user interacts with the page. On load, the data stored in the tracker updates as well.Update the trackerga('set', 'page', '/new-page.html');Record pageviewSend a pageview immediately after the tracker updates −ga('send', 'pageview');

Validate Input File Size and Type in HTML5

karthikeya Boyini
Updated on 25-Jun-2020 06:26:06

362 Views

Yes, it is possible to validate the size and type of input type = “file”. Use jQuery to get the desired result −                                                        $(function(){             $('form').submit(function(){                var val = true;                   $('input[type=file][data-max-size]').each(function(){                      if(typeof this.files[0] !== 'undefined'){                         var max = parseInt($(this).attr('max-size'),10),                         mySize = this.files[0].size;                         val = max > mySize;                         return val;                      }                   });                   return val;                });             });          

Cross-domain HTML5 iframe Issue

Arjun Thakur
Updated on 25-Jun-2020 06:25:26

519 Views

Use the postMessage method for transferring data across different domains.ExampleYou can try the following code snippet to solve the cross-domain HTML5 iframe issue −// Using postMessage() window.onmessage = function(e) {    e.source.postMessage(document.body.innerHTML, e.origin); }; window.onmessage = function(event) {    alert(e.data); }; // fire document.getElementById('frame1').contentWindow.postMessage('','*');

Make Web Page Height Fit Screen Height with HTML

Lakshmi Srinivas
Updated on 25-Jun-2020 06:24:42

3K+ Views

Many ways are available to make the web page height to fit the screen height −Give relative heights −html, body {    height: 100%; }You can also give fixed positioning −#main {    position:fixed;    top:0px;    bottom:0px;    left:0px;    right:0px; }You can also use Viewport height to fulfill your purpose −height: 100vh;

Enable Rear Camera with HTML5

Samual Sam
Updated on 25-Jun-2020 06:23:01

324 Views

To enable rear camera, firstly use −MediaStreamTrack.getSources(gotSources);Now, select the source and pass it in as optional into getUserMedia method.This method is useful for users to set permission to use up to one video input device −var a = {    audio: {       optional: [{sourceId: audioSource}]    },    video: {       optional: [{sourceId: videoSource}]    } }; navigator.getUserMedia(a, successCallback, errorCallback);

Advertisements