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
HTML Articles
Page 95 of 151
Execute a script when the browser starts to work online in HTML?
The ononline event attribute in HTML executes a JavaScript function when the browser detects that it has regained internet connectivity. This event is fired when the browser transitions from offline to online mode, making it useful for handling network state changes in web applications. Syntax Following is the syntax for the ononline attribute − The ononline attribute is typically used on the element and calls a JavaScript function when the browser goes online. How It Works The browser monitors network connectivity and fires the online event when: The ...
Read MoreExecute a script when the browser window is closed in HTML?
The onunload event attribute in HTML triggers when the browser window is being closed, refreshed, or navigated away from. This event allows you to execute JavaScript code before the page is completely unloaded from memory. Syntax Following is the syntax for the onunload attribute − You can also use addEventListener in JavaScript − window.addEventListener('unload', function() { // Your code here }); Using onunload Attribute The onunload event fires when the user leaves the page by closing the browser window, clicking a link, refreshing the ...
Read MoreHow to include the audio/video controls in HTML?
The controls attribute in HTML provides built-in playback controls for audio and video elements. When added to or tags, it displays a control bar with play/pause buttons, volume controls, progress bar, and other standard media controls that users expect. Syntax Following is the syntax for the controls attribute − The controls attribute is a boolean attribute, meaning it does not require a value. Its presence enables the controls, while its absence disables them. Video Controls The controls ...
Read MoreExecute a script when the user writes something in a search field in HTML?
The onsearch attribute in HTML allows you to execute a JavaScript function when the user performs a search action in a search input field. This event triggers when the user presses ENTER or clicks the clear button (×) in browsers that support it. Syntax Following is the syntax for the onsearch attribute − The onsearch attribute calls a JavaScript function when a search event occurs on the search input field. Example − Basic Search Event Following example demonstrates how to use the onsearch attribute to capture search input − ...
Read MoreWhat are the MessageChannel and MessagePort Objects in HTML5?
The MessageChannel and MessagePort objects in HTML5 provide a powerful way to enable secure, bidirectional communication between different browsing contexts such as iframes, web workers, or different windows. When a MessageChannel is created, it internally generates two connected ports that can send data back and forth between separate execution contexts. MessageChannel Object The MessageChannel creates a communication channel with two MessagePort objects. It acts as a pipe that connects two separate browsing contexts, allowing them to exchange messages securely. Syntax var channel = new MessageChannel(); MessagePort Object Each MessageChannel contains two MessagePort ...
Read MoreHow to create a transformation matrix with HTML5?
In the following article, we are going to learn about how to create a transformation matrix with HTML5. 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 transformation matrix is a 2D mathematical representation that defines how points in a coordinate system are mapped to new positions. In canvas context, it enables scaling, rotation, translation, and skewing of drawn elements. 2D Transformation Matrix ┌ a c ...
Read MoreHow to specify the URL of the resource to be used by the object in HTML?
The data attribute in HTML is used to specify the URL of the resource to be used by the element. This attribute defines the location of external content such as images, videos, audio files, Flash files, PDFs, or other multimedia resources that should be embedded in the web page. Syntax Following is the syntax for the data attribute − Alternative content The data attribute accepts a valid URL pointing to the resource file. The URL can be relative (pointing to a file in the same domain) or absolute ...
Read MoreHow to set the audio output of the video to mute in HTML?
Use the muted attribute to set the audio output of the video to mute in HTML. The muted attribute is a boolean attribute that specifies whether the video's audio should be initially silenced when the page loads. Syntax Following is the syntax for the muted attribute − The muted attribute can be written in three ways − muted − Boolean attribute (recommended) muted="muted" − Explicit value muted="" − Empty value How It Works When the muted attribute is present, the video element will start ...
Read MoreWebsockets Apache Server compatibility in HTML5
WebSocket technology enables real-time, bidirectional communication between web browsers and servers. While Apache HTTP Server is widely used for web applications, it presents specific challenges when implementing WebSocket connections due to its traditional request-response architecture. Apache Server was originally designed for stateless HTTP requests, where each request is processed independently and connections are short-lived. WebSockets, however, require persistent connections that remain open for extended periods to enable real-time data exchange. Apache WebSocket Implementation Options Several approaches exist for implementing WebSockets with Apache Server − Using mod_websocket Module The mod_websocket module extends Apache to handle WebSocket ...
Read MoreHTML5 Canvas layer disappears on mouse click in Fabric.js and Firefox stops responding when creating a canvas for the image?
When working with HTML5 Canvas and Fabric.js, you may encounter two common issues: the canvas layer disappearing on mouse click and Firefox becoming unresponsive when creating a canvas for images. These problems often occur due to improper event handling and canvas initialization. Let us explore solutions to resolve these issues. Common Canvas Issues The main problems developers face include − Canvas layer disappearing − This happens when event listeners conflict or when the canvas is not properly initialized. Firefox freezing − This occurs when large images are loaded without proper optimization or when infinite loops are ...
Read More