Found 10483 Articles for Web Development

Using HTML5 Server-Sent Events in a web application

Jennifer Nicholas
Updated on 20-Dec-2019 10:49:19

246 Views

To use Server-Sent Events in a web application, you would need to add an element to the document.The src attribute of the element should point to an URL that should provide a persistent HTTP connection that sends a data stream containing the events.The URL would point to a PHP, PERL or any Python script that would take care of sending event data consistently.ExampleHere is an example showing application that would expect server time.                    /* Define event handling logic here */                                                              

Difference between Session Storage and Local Storage in HTML5

Daniol Thomas
Updated on 30-Jul-2019 22:30:22

812 Views

Session StorageThe Session Storage is designed for scenarios where the user is carrying out a single transaction but could be carrying out multiple transactions in different windows at the same time.Local StorageThe Local Storage is designed for storage that spans multiple windows and lasts beyond the current session. In particular, Web applications may wish to store megabytes of user data, such as entire user-authored documents or a user's mailbox, on the client side for performance reasons.HTML5 introduces the localStorage attribute which would be used to access a page's local storage area without no time limit and this local storage will ... Read More

HTML5 tag

Lakshmi Srinivas
Updated on 29-Jan-2020 06:42:19

243 Views

The HTML5 tag is used to draw SVG Gradients. Yes, modern browsers support it.The following is the HTML5 version of an SVG example that would draw an ellipse using the tag and would use the tag to define an SVG radial gradient. Similar way you can use the tag to create SVG linear gradient.                    #svgelem{             position: relative;             left: 50%;             -webkit-transform: translateX(-40%);             -ms-transform: translateX(-40%);             transform: translateX(-40%);          }             SVG                     HTML5 SVG Gradient Ellipse                                                                              

Usage of autofocus HTML5 attribute

Yaswanth Varma
Updated on 11-Oct-2023 15:47:23

280 Views

We received a greatness from HTML5. Basic HTML can now be used to carry out tasks that JavaScript and Flash previously handled, such as basic form validation, INPUT placeholders, and audio/video. The autofocus attribute in HTML allows us to automatically focus on components when the page loads, which is another straightforward feature. When the autofocus property is present, the page loads with the INPUT, TEXTAREA, or BUTTON element already chosen. This property is particularly helpful on pages whose primary goal is information gathering. Autofocus HTML5 attribute An element should be focused when the page loads or when the a ... Read More

Difference between datetime and datetime-local in HTML5

Yaswanth Varma
Updated on 11-Oct-2023 15:43:21

4K+ Views

The datetime-local input is different from the other one in that it excludes the time zone. Use datetime-local if your application doesn't care about the time zone. The datetime input type is still catching up with some browsers. Let’s look into further for getting better understanding between datetime and datetime-local in HTML5 HTML5 datetime The machine-readable date and time of the element is defined by the HTML datetime Attribute. The time and date are entered in the following format: YYYY-MM-DDThh:mm:ssTZD. Syntax Following is the syntax for HTML datetime Let’s look into the following example ... Read More

input type week really exist in HTML5?

Yaswanth Varma
Updated on 11-Oct-2023 16:46:25

463 Views

The tag designates a field for user-enterable data. The most significant form element is the element. Depending on the type attribute, the element can be presented in a number of different ways. The input element denotes a field for a week input because it has the value "week" in its type property. Instead of requiring users to input the value as a string, these fields could be represented in supporting browsers by controls that let users update it graphically (such as a calendar, for example). Let’s jump into the article to discuss more about input type week ... Read More

Apply gravity between two or more objects in HTML5 Canvas

Nishtha Thakur
Updated on 29-Jan-2020 06:41:21

233 Views

To apply gravity between two or more object in Canvas:var distX = ob1.x - ob2.x, distY = ob1.y - ob2.y; var val = distX *distX + distY * distY; var r = Math.sqrt(val); var F = 50 / val; var rhat_x = distX / r; var rhat_y = distY / r; var Fx = F * rhat_x; var Fy = F * rhat_y; ob1.vx += -Fx; ob1.vy += -Fy; ob2.vx += Fx; ob2.vy += Fy;

Detect area of a PNG that is not transparent with HTML

Lakshmi Srinivas
Updated on 29-Jan-2020 06:40:56

511 Views

To detect an area of a PNG that is not transparent: You need to first get the buffer You need to get 32-bits reference of that buffer Scan 0 widths to find x1 edge Scan width 0 to find x2 edge Height to find the y1 edge Height 0 to find the y2 edge

To “user-scalable=no” or not to “user-scalable=no” in HTML5

Rishi Rathor
Updated on 30-Jul-2019 22:30:22

240 Views

For responsive design, you do not have to use user-scalable=no. Use it only if you want your application to look more like a native app.Zooming is a key feature for accessibility and you need to keep that in mind. You can control that users won't break your design if they zoom in. If you are doing responsive and your design breaks when zooming in, then you're not doing it right.If you totally need to use it, then keep in mind that zooming is an important accessibility feature that is used by many people.

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

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

268 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!'); }

Advertisements