Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles by Nitya Raut
Page 3 of 16
Do any browsers yet support HTML5's checkValidity() method?
Yes, modern browsers widely support HTML5's checkValidity() method. This method validates form elements against their HTML5 constraints and returns true if valid, false otherwise. Browser Support The checkValidity() method is supported in all modern browsers including Chrome, Firefox, Safari, Edge, and Opera. It's been widely supported since around 2012-2013. Syntax element.checkValidity() Return Value Returns true if the element meets all validation constraints, false otherwise. Example .valid { ...
Read MoreWhat is the usage of onpageshow event in JavaScript?
The onpageshow event triggers in JavaScript when a user navigates to a web page, including when the page loads for the first time or when returning from the browser's back/forward cache (bfcache). Syntax // HTML attribute // Event listener window.addEventListener('pageshow', function(event) { // Handle page show }); Example: Basic Usage Here's how to implement the onpageshow event using HTML attribute: On first visit, a welcome message is visible. ...
Read MoreWhat is the usage of and elements? Why they were introduced?
The HTML5 and elements are semantic tags that provide meaningful structure to web content. They improve accessibility for screen readers and help visually impaired users navigate content more effectively. These elements are also beneficial for eBook readers and search engines. The Element The element represents a thematic grouping of content, typically with its own heading. It's used to divide content into distinct sections within a document. Syntax Section Title Section content goes here... Example ...
Read MoreWebsocket for binary transfer of data & decode with HTML5
WebSockets can handle binary data transfer using base64 encoding/decoding. Modern browsers provide built-in methods window.btoa() for encoding and window.atob() for decoding base64 data. Base64 Encoding for Binary Transfer When transferring binary data through WebSockets, encode it as base64 on the client side before sending: // Create WebSocket connection const socket = new WebSocket('ws://localhost:8080'); // Convert ...
Read MoreHow much should be a JavaScript Line Length?
JavaScript line length refers to how many characters should fit on a single line of code. Following proper line length guidelines makes your code more readable and maintainable. Recommended Line Length The standard practice is to keep JavaScript lines under 80 characters. Some modern style guides allow up to 100 or 120 characters, but 80 remains the most widely adopted standard for better readability across different editors and devices. Breaking Long Lines When a statement exceeds the character limit, break it after a comma or operator, not in the middle of a variable name or string. ...
Read MoreWhich event occurs in JavaScript when an element is content is copied to clipboard?
When a user copies an element's content, the oncopy event triggers in JavaScript. This event fires when the user performs a copy operation using Ctrl+C, right-click copy, or any other method to copy selected content. Syntax element.oncopy = function() { // Code to execute when content is copied }; // Or using addEventListener element.addEventListener('copy', function() { // Code to execute when content is copied }); Example: Basic oncopy Event ...
Read MoreUniquely identify files before uploading with the HTML5 file API
While making a file uploader using HTML5 file API, we want to be sure that no duplicate files are uploaded based on actual data. This prevents wasting storage space and bandwidth by uploading identical files multiple times. Calculating a hash with MD5 is not an efficient method as all that happens on the client side and is time-consuming. There is actually no perfect shortcut for this task. Method 1: Basic File Properties Check The simplest approach is to compare basic file properties like name, size, and last modified date: document.getElementById('fileInput').addEventListener('change', function(event) ...
Read MoreHow to list down all the plug-in installed in your browser?
To list down all the plug-ins installed in the web browser, use the JavaScript navigator object. The JavaScript navigator object includes a child object called plugins. This object is an array, with one entry for each plug-in installed on the browser. Understanding navigator.plugins The navigator.plugins property returns a PluginArray object containing Plugin objects representing the plugins installed in the browser. Each plugin object has properties like name, filename, and description. Example You can try to run the following code to list down all the plug-ins installed in your browser: ...
Read MoreHow to use the 'with' keyword in JavaScript?
The with keyword in JavaScript creates a shorthand for referencing an object's properties and methods. However, it's deprecated and not recommended in modern JavaScript due to performance and security issues. Syntax with (object) { // properties used without the object name and dot } Basic Example Here's how with works with a simple object: JavaScript with Statement var person = { ...
Read MoreWith JavaScript how to change the width of a table border?
To change the width of a table border in JavaScript, use the DOM border property or the more specific borderWidth property. This allows you to dynamically modify table borders after the page loads. Syntax element.style.border = "width style color"; element.style.borderWidth = "width"; Example: Changing Table Border Width function borderFunc(x) { document.getElementById(x).style.border = "5px dashed blue"; ...
Read More