Web Development Articles

Page 508 of 801

HTML5 Video Tag in Chrome - Why is currentTime ignored when video downloaded from my webserver?

Chandu yadav
Chandu yadav
Updated on 15-Mar-2026 642 Views

The HTML5 video tag's currentTime property may not work properly in Chrome when your web server doesn't support HTTP range requests (byte-range serving). Chrome requires this feature for video seeking functionality. The Problem When you set currentTime on a video element, Chrome needs to jump to that specific time position in the video file. Without range request support, the browser cannot efficiently seek to arbitrary positions, causing currentTime to be ignored. Testing Your Web Server Check if your server supports byte-range requests using curl: curl --dump-header - -r0-0 http://yourserver.com/video.mp4 Look for this ...

Read More

How to call JavaScript function in an alert box?

Saurabh Jaiswal
Saurabh Jaiswal
Updated on 15-Mar-2026 6K+ Views

To call a JavaScript function in an alert box, you can use the alert() function, a built-in function in JavaScript that displays an alert dialog with a specified message. An alert box is a simple dialog box that displays a message to the user and provides an OK button. It is a built-in function in JavaScript that is often used for debugging or displaying simple notifications to the user. Here's an example of how to use the alert() function in JavaScript: alert("Hello, World!"); ...

Read More

Calculating median of an array in JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 15-Mar-2026 4K+ Views

In this problem statement, our task is to calculate the median of an array with the help of Javascript functionalities. There are several ways that can be used to solve this task. One simple method to calculate median is using the built-in function of Javascript. Understanding the Problem The problem statement is to write a function in Javascript that will help to calculate the median of a given array. The median is the middle value when numbers are arranged in ascending order. For example: Array [1, 2, 3, 4, 5] has median 3 (middle element) Array ...

Read More

Find number of spaces in a string using JavaScript

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 15-Mar-2026 3K+ Views

In JavaScript, counting spaces in a string is a common task that can be accomplished using several built-in methods. This article explores different approaches to find the number of space characters in a string. Problem Overview Given a string with space characters, we need to count how many spaces it contains. For example, the string "Hello world example" contains 2 spaces. const exampleString = "This is an example of counting spaces"; // Expected output: 6 spaces Method 1: Using split() Method The split() method divides a string into an array based on a ...

Read More

How to find distance between items on array JavaScript?

Nikitasha Shrivastava
Nikitasha Shrivastava
Updated on 15-Mar-2026 2K+ Views

In JavaScript, finding the distance between array items means calculating how many positions separate two elements. The distance is measured as the absolute difference between their index positions. Understanding the Problem Array distance represents the number of steps needed to move from one element to another. For example, in the array [1, 2, 3, 4, 5], the distance between elements 2 and 4 is 2 because their indices are 1 and 3 respectively, giving us |3 - 1| = 2. Basic Distance Calculation The simplest approach uses indexOf() to find element positions and calculates the absolute ...

Read More

Difference between == and === operator in JavaScript

Kiran Kumar Panigrahi
Kiran Kumar Panigrahi
Updated on 15-Mar-2026 9K+ Views

JavaScript is widely used to create interactive web pages. It has many frameworks such as React JS, Angular JS, Node JS, etc. Like any other programming language, JavaScript also provides operators like arithmetic, relational, comparison operators, etc. The equality operator, i.e., "==" is one such comparison operator that checks whether the LHS is equal to RHS or not. This operator is present in all other programming languages but it is somewhat different in JavaScript. This is due to the fact that JavaScript is a loosely typed language, whereas all other languages are strictly typed. As JS is loosely typed, it ...

Read More

Explain focus events in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 1K+ Views

Focus events in JavaScript are triggered when HTML elements gain or lose focus on a web page. These events are essential for creating interactive user interfaces and handling form interactions effectively. Focus events occur when users interact with focusable elements like input fields, buttons, or links through clicking, tabbing, or keyboard navigation. Understanding these events helps create responsive and accessible web applications. Types of Focus Events JavaScript provides four main focus events: focus − Triggered when an element gains focus. Does not bubble up the DOM tree. blur − ...

Read More

PreventDefault( ) vs Return false in JavaScript?

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 3K+ Views

In JavaScript, when handling events, you often need to prevent the default browser behavior. The two common approaches are preventDefault() and return false, but they work differently. The preventDefault() method stops only the default action, while return false stops both the default action and event propagation. Key Differences preventDefault() return false Method available on event objects JavaScript statement that can be used anywhere Stops only the default behavior Stops default behavior AND event propagation Allows event to continue bubbling up Stops event bubbling and function execution ...

Read More

Location protocol Property in JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 296 Views

The location.protocol property in JavaScript returns the protocol scheme of the current webpage's URL, including the colon (:). It's a read-only property that helps identify whether a page is served over HTTP, HTTPS, or other protocols. Syntax location.protocol Return Value Returns a string representing the protocol scheme, including the trailing colon. For example: "https:", "http:", "file:", etc. Common Protocol Values http: − Hypertext Transfer Protocol (unsecured) https: − Hypertext Transfer Protocol Secure (secured with SSL/TLS) file: − Local file system access ...

Read More

Creating auto-resize text area using JavaScript

AmitDiwan
AmitDiwan
Updated on 15-Mar-2026 1K+ Views

In this post, we are going to learn how to set up an auto-resize text area in JavaScript. This text area will be able to change its height automatically depending on the content within it. Auto-resize text in JavaScript is a helpful feature that can be used to edit multiple lines of text. The text can automatically change its height depending on the content inside it. The default behavior of textarea doesn't allow this, but we can create it by using the input event listener over it. Let's understand how to adjust the height of the text area element ...

Read More
Showing 5071–5080 of 8,010 articles
« Prev 1 506 507 508 509 510 801 Next »
Advertisements