Object Oriented Programming Articles

Page 77 of 589

How to inject JavaScript in WebBrowser control?

Arjun Thakur
Arjun Thakur
Updated on 15-Mar-2026 2K+ Views

To inject JavaScript in WebBrowser control, you need to create a Windows Forms application and use the WebBrowser control's document manipulation capabilities. This allows you to dynamically add JavaScript code to web pages loaded in your application. Prerequisites Create a Windows Forms application in Visual Studio Drag a WebBrowser control to the form Set the Url property of the WebBrowser control Right-click the project, choose Add reference... → COM → Type Libraries Select "Microsoft HTML Object Library" ...

Read More

How to set the order of the flexible item, relative to the rest with JavaScript?

Ankitha Reddy
Ankitha Reddy
Updated on 15-Mar-2026 176 Views

To set the order of flexible items relative to each other in JavaScript, use the order property. This CSS property controls the visual order of flex items without changing the HTML structure. Syntax element.style.order = "value"; The order property accepts integer values (positive, negative, or zero). Items with lower values appear first, and items with the same order value appear in their original HTML order. Example Here's how to reorder flex items dynamically using JavaScript: ...

Read More

Is their JavaScript scroll event for iPhone/iPad?

Abhinanda Shri
Abhinanda Shri
Updated on 15-Mar-2026 434 Views

Yes, iOS Safari captures scroll events on iPhone and iPad. However, iOS handles scrolling differently than desktop browsers, using momentum scrolling and gesture-based interactions. Basic Scroll Event Detection You can use the standard scroll event listener on iOS devices: Scroll this content on mobile... Content line 2 Content line 3 Content line 4 Content line 5 Scroll position: 0 const scrollable = document.getElementById('scrollable'); const output = ...

Read More

How to set height equal to the dynamic width (CSS fluid layout) in JavaScript?

Rishi Rathor
Rishi Rathor
Updated on 15-Mar-2026 729 Views

To set height equal to the dynamic width in JavaScript, you can calculate the element's width and apply it as the height. This creates a perfect square that maintains its aspect ratio as the parent container resizes. Using jQuery jQuery provides a simple way to get and set element dimensions: .wrap { width: 400px; ...

Read More

What's the best way to detect a 'touch screen' device using JavaScript?

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

The best way to detect a touch screen device is to check whether touch events are supported in the browser's document model. This approach tests for the presence of touch event properties. Basic Touch Detection The most reliable method is to check for the ontouchstart property in the document element: function checkTouchDevice() { return 'ontouchstart' in document.documentElement; } // Test the function console.log("Touch device:", checkTouchDevice()); // Display result on page document.body.innerHTML = "Touch Device: " + checkTouchDevice() + ""; Enhanced Touch Detection Method For better compatibility ...

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

What is JavaScript garbage collection?

Vrundesha Joshi
Vrundesha Joshi
Updated on 15-Mar-2026 417 Views

JavaScript automatically manages memory allocation and deallocation through a process called garbage collection. When you declare variables or create objects, JavaScript allocates memory for them. The garbage collector then identifies and frees memory that is no longer needed by your application. How Garbage Collection Works JavaScript's garbage collector runs automatically in the background, scanning memory to find objects that are no longer reachable or referenced by your code. When these "orphaned" objects are found, their memory is freed up for reuse. Mark-and-Sweep Algorithm The most common garbage collection algorithm in modern JavaScript engines is the mark-and-sweep ...

Read More

How to convert a binary NodeJS Buffer to JavaScript ArrayBuffer?

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

Converting a binary NodeJS Buffer to JavaScript ArrayBuffer is a common requirement when working with binary data across different JavaScript environments. There are multiple approaches to achieve this conversion. Method 1: Using buf.buffer Property (Direct Access) The simplest approach is to access the buf.buffer property directly. However, this creates a view of the underlying ArrayBuffer, not a copy. const buffer = Buffer.from([1, 2, 3, 4, 5]); console.log("Original Buffer:", buffer); // Direct access to underlying ArrayBuffer const arrayBuffer = buffer.buffer; console.log("ArrayBuffer byteLength:", arrayBuffer.byteLength); // Create Uint8Array view to inspect data const uint8View = new Uint8Array(arrayBuffer); ...

Read More

How to create SVG graphics using JavaScript?

Govinda Sai
Govinda Sai
Updated on 15-Mar-2026 730 Views

SVG (Scalable Vector Graphics) can be dynamically created and manipulated using JavaScript. This allows you to generate interactive graphics, charts, and animations programmatically. Creating SVG Elements with JavaScript To create SVG elements in JavaScript, use document.createElementNS() with the SVG namespace. Here's how to create a basic SVG container and add shapes: SVG with JavaScript // SVG namespace ...

Read More

How to display JavaScript variables in an HTML page without document.write?

Sravani S
Sravani S
Updated on 15-Mar-2026 573 Views

Use Element.innerHTML in JavaScript to display JavaScript variables in an HTML page without document.write(). This approach provides better control over content placement and doesn't overwrite the entire page. Basic Example: Displaying Variables Here's how to display JavaScript variables using innerHTML: Display Variables User Information Name: Age: City: // JavaScript variables ...

Read More
Showing 761–770 of 5,881 articles
« Prev 1 75 76 77 78 79 589 Next »
Advertisements