The Chrome browser on iOS does not fire the Image onLoad event

In my web application, I am utilizing Scala.js and d3.js (scala-js-d3) to generate an SVG. However, I have encountered a problem with the background image not triggering the load event when using Chrome on iOS (iPhone), even though it works fine on Windows.

This is how I insert the background image:

d3.select("#backgroundImg")
  .append("image")
  .attr("id", "graphBackgroundImage")
  .attr("width", "1954px")
  .attr("height", "1532px")
  .attr("xlink:href", "img/maps/map.png")
  // TODO this load event does not trigger on iOS!
  .on("load", (_: EventTarget) => { println("image loaded") } : Unit)
  .on("error", (_: EventTarget) => { prinltn("an error has occurred") } : Unit)

When tested on Windows, the above code generates the following svg dom element (and all functions as expected):

<g id="backgroundImg">
  <image id="graphBackgroundImage" width="1954px" height="1532px" xlink:href="img/maps/map.png"></image>
</g>

Debugging on iPhone has proven challenging, but I have observed that the message image loaded is not logged when using Chrome on iOS (and there are no an error has occurred logs either).

Answer №1

If you're looking for more information on this topic (excluding scala JS), check out this link: Helpful Resource

Another resource that might be useful can be found here: Useful Link

The key to solving the problem was identifying "css properties specifying 'pointer events'".

Could you please share the URL for review? I have another potential solution in mind, but I'll need to examine more of the code first.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having issues with npm python-shell integration within electron framework

I'm currently attempting to establish a connection between a python script and an Electron app by utilizing the npm's python-shell package. The requirement is for the script to be executed whenever a button is clicked. So, let's assume my d ...

Searching for an element with a changing name using jQuery - Struggling with quotes

Looking to navigate my DOM based on the value of an option in a select box. The value of "searchkey" can vary based on user input, for example: searchkey = dell'anno searcheky = dell"anno These options, particularly the first one, can cause issues ...

Overlap one element entirely with another

Currently, I am working on a way for an element called overlayElement to completely cover another element known as originalElement. The overlayElement is an iFrame, but that detail may not be significant in this scenario. My goal is to ensure that the over ...

The JQuery datepicker fails to provide the date in the format mm/dd/yy

Recently, I attempted to transform a date into the dd/mm/yy format using JQuery datepicker. Unfortunately, my results displayed in the dd/mm/yyyy format instead. Here is the code snippet that I utilized: chkIn = $.datepicker.formatDate("dd/mm/yy", cinDate ...

The autoComplete feature in my ReactJs form is not functioning properly

I have a form in React where I would like to enable auto complete so that when users input the same value again, it will be suggested as an auto complete option. Below is the code snippet: <form className={classes.container} noValidate> <Grid c ...

What could be the reason why the AngularJS form is set to read-only

Explaining the setup of my app in HTML: <div ng-app="md-app"> <div id="general"> <ng-include src="template1" ng-controller="GeneralCtrl"></ng-include> </div> </div> The JavaScript function to fetch a pe ...

Issue with Material UI tool tip not closing upon clicking on an element is persistent

Check out this link for a material UI tooltip demo I have been experimenting with the material UI tooltip in the provided link. The tooltip pops up when hovering over the button, but it doesn't disappear when clicking on the button. Is this the defau ...

Issue importing Reactjs and material-ui library in application

I have a quick question about importing a component from a material-ui library in my React project. Despite having the correct path, the module cannot be found. Here is the code snippet: import React from 'react'; import ReactDOM from 're ...

Glowing beams of light emitted by point light in three.js

Is there a way to visualize light rays from a point light in a Three.js scene without affecting the entire scene with fog color? var width = $('#g_pre_emo').width(); var scene = new THREE.Scene(); scene.fog = new THREE.Fog(0xffff00, 0, 10); ...

An unusual syntax issue triggered within the jquery file resulted in an error being thrown

While browsing my website, I encountered an error and found myself looking at the following snippet of code (located within a jQuery .js file): trigger: function() { return this !== _() && this.focus ? (this.focus(), !1) : void 0 } I am curious ...

What methods are available for testing JavaScript interactions like freehand drawing on an HTML5 canvas using a mouse?

When it comes to testing object states, I am well-versed in using rspec in Ruby on Rails models. For instance, ensuring that a certain object meets certain expectations based on its prior state and a specific call. However, I am now faced with a new chall ...

Best Practices for Downloading Images for TableViews in Firebase for iOS

After following the Firebase tutorial by Ray Wenderlich (Link) and implementing his method of initializing objects (in my case, a "Location" object) with data from the observer method snapshot: class Location: init(snapshot: FIRDataSnapshot) { identi ...

Is it necessary to scroll when all elements on the page are in absolute position?

I have all elements positioned absolutely on my page. Some are at the top and some are at the bottom. However, when I add an additional element to display news text in the center of the page, it gets hidden under the element aligned at the bottom. When I s ...

Having trouble getting NextJS to work with jsmpeg/node-rtsp-stream for displaying an RTSP stream

Exploring: https://github.com/kyriesent/node-rtsp-stream and How to display IP camera feed from an RTSP url onto reactjs app page? I attempted to showcase the RTSP stream from a CCTV but encountered an error. ReferenceError: document is not defined at scri ...

Retrieving information from a JSON web service can easily be done using just JavaScript and jQuery

I recently downloaded a sample application from the following URL: . I am pleased to report that the part I have implemented is functioning flawlessly: <script src="scripts/jquery-1.3.2.debug.js" type="text/javascript"></script> <script src ...

The process of how screen readers interpret HTML elements

It is important to understand that screen readers not only read the content within elements and tags, but also the elements or tags themselves. For example: <button class="class-of-the-button">Text inside</button> When read by a screen reader ...

The typewriter effect is configured to appear as a separate layout,

<div className= "HomePage-typewriter"> I do{'\u00A0'} <Typewriter options={{ strings: [ '<span> this </span>', '<span> that </span>', '<span&g ...

When attempting to use the .includes() method on a property within an array, I encountered an issue with a TypeError stating that .includes is not a function

I need help with filtering a group of activities based on the year they were carried out. Here is an example of the data structure: activities: [ { title: "Playing soccer at school", years: [2023,2024] }, { title: "Playing guitar at ...

Executing a JavaScript/jQuery function on the following page

I'm currently working on developing an internal jobs management workflow and I'd like to enhance the user experience by triggering a JavaScript function when redirecting them to a new page after submitting a form. At the moment, I am adding the ...

Steps for showing an Alert view after a certain number of taps have been received

I'm trying to figure out how to display an alert after a button has been tapped a certain number of times. Here's what I have so far: - (IBAction)count:(id)sender { UITouch *touch = [count]; if (touch.tapCount == 4) { UIAler ...