HTML5 Canvas Transformation Matrix

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

592 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

879 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

195 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

270 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

376 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

532 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

343 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);

Getting Tooltips for Mobile Browsers in HTML

George John
Updated on 25-Jun-2020 06:22:05

1K+ Views

When you will click on an element with a title attribute, a child element with title text is appended. Let us see an example −For HTML −    The underlined character. jQuery −$("span[title]").click(function () {    var $title = $(this).find(".title");    if (!$title.length) {       $(this).append('' + $(this).attr("title") + '');    } else {       $title.remove();    } });The following is the CSS −.demo {    border-bottom: 2px dotted;    position: relative; } .demo .title {    position: absolute;    top: 15px;    background: gray;    padding: 5px;    left: 0;    white-space: nowrap; }

Move to HTML5 with Multi-Browser Compatibility

Arjun Thakur
Updated on 25-Jun-2020 06:20:19

234 Views

Yes, follow this approach −Move to the HTML5 doctype − Use or even the new elements like Or the newer HTML5 tags or , you can still use the outdated tag.The controls have backward compatibility too. The works the same as in browsers that do not support it.However, if you are working t for legacy Internet Explorer, then use html5shiv. It enables the use of HTML5 sectioning elements in legacy Internet Explorer.

Advertisements