Smita Kapse

Smita Kapse

388 Articles Published

Articles by Smita Kapse

Page 3 of 39

Detect folders in Safari with HTML5

Smita Kapse
Smita Kapse
Updated on 15-Mar-2026 196 Views

Safari has limited support for folder detection compared to other browsers. When users drag and drop folders, Safari treats them differently than individual files, which can cause errors during file reading operations. The Problem with Folders in Safari When a folder is dropped onto a web page, Safari includes it in the files collection but cannot read its contents using FileReader. This causes the onerror event to trigger, which we can use to detect folder drops. Folder Detection Method The following code attempts to read each dropped item as a file. If it's a folder, the ...

Read More

How can I list all cookies on the current page with JavaScript?

Smita Kapse
Smita Kapse
Updated on 15-Mar-2026 1K+ Views

In JavaScript, you can list all cookies on the current page using the document.cookie property. This property returns a string containing all cookies as semicolon-separated key-value pairs. Basic Cookie Retrieval The simplest way to get all cookies is to access document.cookie directly: // Set some sample cookies first document.cookie = "username=john; path=/"; document.cookie = "theme=dark; path=/"; ...

Read More

What HTML5 tag should be used for filtering search results.

Smita Kapse
Smita Kapse
Updated on 15-Mar-2026 280 Views

HTML5 provides semantic elements for organizing content, but there's no specific tag exclusively for filtering search results. The best approach is to use a combination of semantic elements with appropriate roles and structure. Recommended Structure for Search Filters Use the element with filter controls inside a for better semantics and accessibility: Search Results Filter Results ...

Read More

With JavaScript RegExp search a hexadecimal number character.

Smita Kapse
Smita Kapse
Updated on 15-Mar-2026 474 Views

To find a hexadecimal number character with JavaScript Regular Expression, use the \x escape sequence followed by the two-digit hexadecimal value. Syntax \xdd Where dd represents the two-digit hexadecimal value (00-FF) of the character you want to match. Example: Searching for Hexadecimal Character The following example searches for hexadecimal number 53, which represents the character 'S': JavaScript Regular Expression ...

Read More

Difference between MessageChannel and WebSockets in HTML5

Smita Kapse
Smita Kapse
Updated on 15-Mar-2026 244 Views

WebSockets and MessageChannel are both HTML5 communication technologies, but they serve different purposes. WebSockets enable real-time communication between browser and server, while MessageChannel facilitates secure communication between different browsing contexts within the same application. WebSockets Overview WebSockets provide bidirectional communication between browser and server over a single persistent connection. They're ideal for real-time applications like chat systems, live updates, and gaming. // WebSocket connection to server const socket = new WebSocket('wss://example.com/socket'); socket.onopen = function(event) { console.log('WebSocket connected'); socket.send('Hello Server!'); }; socket.onmessage = function(event) { ...

Read More

How to turn a String into a JavaScript function call?

Smita Kapse
Smita Kapse
Updated on 15-Mar-2026 594 Views

In JavaScript, you can dynamically call a function by converting a string containing the function name into an actual function call. This is useful when function names are determined at runtime. Using window Object (Browser) The most common method in browsers is using the window object to access globally defined functions: function myFunction(argument) { alert('My function ' + argument); } ...

Read More

What is the difference between break and continue statements in JavaScript?

Smita Kapse
Smita Kapse
Updated on 15-Mar-2026 718 Views

JavaScript provides two important control statements for modifying loop execution: break and continue. While both affect loop flow, they serve different purposes. break Statement The break statement is used to exit a loop completely, terminating the entire loop execution and transferring control to the statement immediately following the loop. Example var x = 1; document.write("Entering the loop"); ...

Read More

Which one is better to use for a JavaScript link, "#" or "javascript:void(0)"?

Smita Kapse
Smita Kapse
Updated on 15-Mar-2026 260 Views

When creating JavaScript links that don't navigate to another page, developers often choose between "#" and "javascript:void(0)". Both prevent default navigation, but they behave differently and have distinct use cases. Understanding the Difference The "#" anchor creates a link to the top of the current page and adds a hash to the URL, while "javascript:void(0)" executes JavaScript that returns undefined, preventing any navigation without affecting the URL. Using "#" Hash Links The hash symbol creates an anchor link that jumps to the top of the page if no element with that ID exists: ...

Read More

What is "function*" in JavaScript?

Smita Kapse
Smita Kapse
Updated on 15-Mar-2026 350 Views

The function* declaration defines a generator function that returns a Generator object. Unlike regular functions, generators can pause execution with yield and resume later, making them powerful for controlling program flow and creating iterators. Syntax Generator functions can be declared with function* in three equivalent ways: function* myFunction() {} // or function *myFunction() {} // or function*myFunction() {} How Generator Functions Work When called, a generator function doesn't execute immediately. Instead, it returns a generator object with methods like next() to control execution step by step. Basic Example ...

Read More

How to position text to top left position on an image with CSS

Smita Kapse
Smita Kapse
Updated on 15-Mar-2026 1K+ Views

To position text to the top left position on an image, use the position property with absolute positioning along with the top and left properties. The parent container must have position: relative to serve as the positioning reference. Syntax .container { position: relative; } .text-overlay { position: absolute; top: value; left: value; } Example The following example demonstrates how to position text at the top left corner of an image − ...

Read More
Showing 21–30 of 388 articles
« Prev 1 2 3 4 5 39 Next »
Advertisements