Karthikeya Boyini has Published 2382 Articles

Creating custom attributes with HTML5

karthikeya Boyini

karthikeya Boyini

Updated on 29-Jan-2020 08:38:59

291 Views

A new feature introduced in HTML 5 is the addition of custom data attributes.A custom data attribute starts with data- and would be named based on your requirement.    ... The above will be perfectly valid HTML5 with two custom attributes called data-subject and data-level. You would be able to ... Read More

Log error to console with Web Workers in HTML5

karthikeya Boyini

karthikeya Boyini

Updated on 29-Jan-2020 08:34:25

436 Views

Here is an example of an error handling function in a Web Worker JavaScript file that logs errors to the console.ExampleWith error handling code, above example would become like the following:           Big for loop                var worker ... Read More

Resize image before submitting the form HTML5

karthikeya Boyini

karthikeya Boyini

Updated on 29-Jan-2020 08:22:08

232 Views

To resize the image before submitting the form, you need to use the drawImage() method.Scale the original image and draws the scaled version on the canvas at [0, 0]context.drawImage( img, 0, 0, img.width, img.height, 0, 0, myWidth, UseHeight );Above, we saw the following:Here, var myWidth = Math.floor( img.width * Scale ... Read More

XMLHttpRequest for Video Tag?

karthikeya Boyini

karthikeya Boyini

Updated on 29-Jan-2020 08:14:09

375 Views

The HTML5 file Blob.slice() method is useful for creating a Blob object containing the data. This data is in the specified range of bytes of the source Blob. It uses XMLHttpRequest as in the below example.Let us see an example to send and receive binary data using slice(). This example ... Read More

How to keep the image at the back of the HTML5 canvas when moving elements with fabric.js?

karthikeya Boyini

karthikeya Boyini

Updated on 29-Jan-2020 08:11:26

267 Views

To keep the image at the back of the canvas, when move elements, you need to pass:preserveObjectStackingAnd the following would work and the image is not visible in the background:window.canvas = new fabric.Canvas('c', { preserveObjectStacking:true });Now, on moving the shape will appear over the image.

How can I handle Server-Sent Events in HTML5?

karthikeya Boyini

karthikeya Boyini

Updated on 29-Jan-2020 07:04:00

102 Views

To handle Server-Sent Events in HTML5, you can try to run the following code:                    document.getElementsByTagName("eventsource")[0].addEventListener("server-time", eventHandler, false);          function eventHandler(event)          {             // Alert time sent by the server             document.querySelector('#ticker').innerHTML = event.data;          }                                                    [TIME]          

canvas.style.display = “block” not working in HTML5

karthikeya Boyini

karthikeya Boyini

Updated on 29-Jan-2020 06:40:33

180 Views

Change the setTimeout() to use a function reference. It works as the function available at the time the reference.The reference will be transferred to the timeout event callback rather than a string reference:window.setTimeout(startNow, 2000);Set it like the following:setTimeout(startNow, 1000); function startNow () {    alert(‘Working correctly!'); }Read More

Retrofit existing web page with mobile CSS

karthikeya Boyini

karthikeya Boyini

Updated on 29-Jan-2020 06:37:40

98 Views

To retrofit, use the CSS media queries, and allow different stylesheets to different browser capabilities. A benefit is that you do not have to go for any server-side code.This would require you to add specific detection code to the script for grouping of the device.The media queries handle even devices ... Read More

HTML5 audio not playing in PhoneGap App

karthikeya Boyini

karthikeya Boyini

Updated on 29-Jan-2020 06:27:24

141 Views

If you have set all the attributes and audio source correctly, then this can be a security issue.Add the following in your index.html.Set the AndroidManifest.xml as

How can we create a new MySQL table by selecting specific column/s from another existing table?

karthikeya Boyini

karthikeya Boyini

Updated on 29-Jan-2020 05:16:32

137 Views

As we know that we can copy the data and structure from an existing table by CTAS script. If we want to select some specific column/s from another table then we need to mention them after SELECT. Consider the following example in which we have created a table named EMP_BACKUP1 ... Read More

Advertisements