George John

George John

789 Articles Published

Articles by George John

Page 18 of 79

HTML5 Geolocation in Safari 5

George John
George John
Updated on 15-Mar-2026 1K+ Views

HTML5 Geolocation API lets you share your location with your favorite web sites. A JavaScript can capture your latitude and longitude, can be sent to backend web server, and do fancy location-aware things like finding local businesses or showing your location on a map. How Geolocation Works The Geolocation API uses navigator.geolocation to access device location. It requires user permission and works through GPS, WiFi, or IP-based positioning. Basic Syntax navigator.geolocation.getCurrentPosition(successCallback, errorCallback, options); Example: Getting Current Position Here's how to get the user's current location: ...

Read More

How do I clear the usage of setInterval()?

George John
George John
Updated on 15-Mar-2026 259 Views

The setInterval() method executes a function repeatedly at specified intervals. Unlike setTimeout() which runs once, setInterval() continues indefinitely until cleared. Syntax let intervalId = setInterval(function, delay); Example: Basic setInterval Usage let count = 0; let intervalId = setInterval(function() { count++; console.log("Hello " + count); // Stop after 3 executions if (count === 3) { clearInterval(intervalId); ...

Read More

How to deal with Internet Explorer and addEventListener problem "Object doesn't support this property or method" in JavaScript?

George John
George John
Updated on 15-Mar-2026 2K+ Views

Internet Explorer versions 8 and below don't support the standard addEventListener() method, causing the "Object doesn't support this property or method" error. This article shows how to handle cross-browser event handling. The Problem Modern browsers use addEventListener() for event handling, but older Internet Explorer versions use attachEvent() instead. Using addEventListener() directly will fail in IE8 and below. Solution 1: Using IE=edge Meta Tag Force Internet Explorer to use its latest rendering engine by adding this meta tag to your HTML head: ...

Read More

Alternatives to HTML5 iframe srcdoc?

George John
George John
Updated on 15-Mar-2026 631 Views

The HTML tag is used to create an inline frame. While the srcdoc attribute allows embedding HTML content directly, several alternatives exist for dynamically setting iframe content. Understanding iframe srcdoc The srcdoc attribute specifies HTML content to display inside an iframe without requiring an external URL. iframe srcdoc Example Alternative 1: Using contentWindow.document Access the iframe's document object directly to write content programmatically. contentWindow Alternative ...

Read More

HTML5 tag on Android for PhoneGap application

George John
George John
Updated on 15-Mar-2026 268 Views

PhoneGap is a software development framework by Adobe System, which is used to develop mobile applications. PhoneGap produces apps for all popular mobile OS platforms such as iOS, Android, BlackBerry, and Windows Mobile OS etc. HTML5 Audio support is not consistent across different devices due to codec licensing issues and OS implementation. For playing MP3 files, this can be handled by using PhoneGap's Media class that provides reliable audio programming across all platforms. Using PhoneGap Media Class The Media class provides audio recording and playback functionality. Here's how to implement basic audio playback: // Create ...

Read More

HTML5 file uploading with multiple progress bars

George John
George John
Updated on 15-Mar-2026 472 Views

HTML5 provides native file upload capabilities with progress tracking. When uploading multiple files, you can create individual progress bars for each file by leveraging the XMLHttpRequest progress events. The Challenge The main challenge is associating each XMLHttpRequest with its corresponding progress bar element. This requires storing a reference to the list item in the XMLHttpRequest object. Setting Up the Progress Tracking To track progress for multiple files, you need to bind each XMLHttpRequest to its corresponding list item element before starting the upload: Multiple File Upload with ...

Read More

How to make the user login for an offline web app?

George John
George John
Updated on 15-Mar-2026 543 Views

Offline web apps require a different authentication approach since they can't always connect to servers. The key is implementing local authentication with data synchronization when online. How Offline Login Works When online, authenticate against the server and store user credentials locally. When offline, authenticate against the local storage instead of the remote server. User Login Online? Check Server Offline? Check Local Grant Access ...

Read More

Bootstrap Collapsible list group

George John
George John
Updated on 15-Mar-2026 4K+ Views

To create a collapsible list group in Bootstrap, combine the panel-collapse property with the list-group property. This creates an expandable section containing a list of items that can be toggled with a click. Basic Structure A collapsible list group consists of three main components: Panel container: Wraps the entire collapsible section Panel header: Contains the clickable trigger element Collapsible content: Houses the list group items Example The following example demonstrates a collapsible list group with programming languages. Click the "Info" header to expand or collapse the list: ...

Read More

HTML5 Canvas Font Size Based on Canvas Size

George John
George John
Updated on 15-Mar-2026 930 Views

When working with HTML5 Canvas, you often need to scale font sizes dynamically based on the canvas dimensions to maintain proportional text across different screen sizes. The Problem Fixed font sizes don't adapt when canvas dimensions change, making text too small on large canvases or too large on small ones. Solution: Proportional Font Scaling Use a ratio-based approach to calculate font size relative to canvas width: var fontBase = 800; // Base canvas width var fontSize = 60; // Desired font size at base width function getFont(canvas) { ...

Read More

Is HTML5 canvas and image on polygon possible?

George John
George John
Updated on 15-Mar-2026 475 Views

Yes, it is possible to draw images on polygons in HTML5 canvas. You can achieve this by creating a pattern from an image and applying it as a fill, or by using transformation matrices to manipulate how the image is drawn within the polygon shape. Method 1: Using Image Patterns Create a pattern using the image object and set it as the fillStyle for your polygon: const canvas = document.getElementById('myCanvas'); const context = canvas.getContext("2d"); // Create an image object const img = new Image(); img.onload = function() { ...

Read More
Showing 171–180 of 789 articles
« Prev 1 16 17 18 19 20 79 Next »
Advertisements