JavaScript

RSS for tag

Discuss the JavaScript programing language.

JavaScript Documentation

Posts under JavaScript tag

88 Posts
Sort by:
Post not yet marked as solved
0 Replies
247 Views
Is it possible to get 240Hz Apple Pencil events in Javascript? I know that with UIKit you have to poke at coalesced events to get this sort of sampling frequency, but it appears that Safari (and Mobile Safari) do not support the new PointerEvents.getCoalescedEvents() API (https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/getCoalescedEvents). Anyone know of another way to get high-frequency 240Hz Apple Pencil events (e.g. as touchmove or pointermove events)?
Posted
by
Post marked as solved
1 Replies
1.9k Views
Hi, I'm having issues with scrolling on iOS (web). I have a web app that when you click on different pill shaped menus scrolls to the appropriate/related element on the page. When I click a different pill menu when scrolling is happening I get glitches on iOS browsers (safari/chrome) whereas everything is fine on Chrome Android. The wanted behavior is that when you click on the pill the scrolling goes to the needed item with no glitching or pause. I use jQuery's animate to scroll to the needed element and the scroll listener to detect whether the page is at the right position to illuminate the right pill (make it active). Is there any advice/recommendations to fix this issue?
Posted
by
Post not yet marked as solved
0 Replies
406 Views
The following problem: I have built a Blazor app where you can move around elements. To do this I use the events 'pointerdown', 'pointermove' and 'pointerup'. It works on all platforms except the PWA variant on IPadOS 14.0 Safari. The incorrect behavior occurs on several IPads, including an IPad 8th Generation, IPad 3rd Generatio and IPad Pro, After that I built a demo application in which the same error occurs and can be reproduced. To reproduce the error, you must try to move one of the elements (green, blue, purple) directly. If you hold one of the elements for 500ms beforehand, the error does not occur and the selected element can be moved without problems. The link to the demo app is https://pointermove.azurewebsites.net/ The link to the repository is https://github.com/Stefan-at-DEVWARE/PointerMoveProblemPWA
Posted
by
Post not yet marked as solved
1 Replies
761 Views
html2canvas library is used in our js project however it leads to white screen after upgrade to ios 15, may i understand what feature in ios15 actually casue that and will it be fixed in later version?
Posted
by
Post not yet marked as solved
0 Replies
444 Views
- 1. Operating system (iOS) - 15 * 2. Mode - Landscape * 3. Browser - safari * 4. Device - iPhone 8 plus( issue for all device) I updated my device (iPhone 8 plus) with latest iOS 15. When i load my application it loads in minimal view and showing address bar at top. When i try to make my app to full screen ideally it should trigger resize event but it is triggering resize event then scroll event. So my app resize to full screen and due to scroll down event it resets again and due to that not able to full screen For previous iOS version events get triggered properly this issue occurred after latest OS update i.e 15 I am using this event to manage view port of all other devices. Can we get more details why resize event is not gets triggered and scroll event get triggered manually which was not happening for previous iOS version ? This issue is happening in Landscape mode only
Posted
by
Post not yet marked as solved
1 Replies
898 Views
I'm using this js package  https://www.npmjs.com/package/idb to manage a simple indexedDB implementation on a web app. I'm using the excellent https://www.npmjs.com/package/idb package to manage a simple indexedDB implementation on a web app. I'm having this error "UnknownError: Database deleted by request of the user" reported to our error reporting system for a significant number of iOS users and I'm having trouble replicating. It seems to have so far only affect users on: Mobile Safari 14.6, 14.4.2, caught by try/catch Instagram webview, iOS 14.7.1 - not caught be try/catch I think the source of the error is this line in webkit https://github.com/WebKit/WebKit/blob/e98ff129bc8eba06ac17105f19c5f0e142aab853/Source/WebCore/Modules/indexeddb/shared/IDBError.h#L40 It seems to relate to the server connection closing. Can anyone help me understand what conditions are required to trigger this error so that I can replicate and try to handle in the app? A simplified version of the implementation: // ./store.js import { openDB } from 'idb' export const upgrade = (db) => { if (!db?.createObjectStore) return null db.createObjectStore('example_store_name_1') } export const set = async (storeName, val, key) => { const dbPromise = openDB('example_db_name', 1, { upgrade }) if (!window.indexedDB) return null return (await dbPromise).put(storeName, val, key) } export const count = async (storeName) => { const dbPromise = openDB('example_db_name', 1, { upgrade }) if (!window.indexedDB) return null return (await dbPromise).count(storeName) } // ./index.js import { set, count } from './store.js' export const storeEvent = async (storeName, value, key) => { try { const rowCount = await count(storeName) // I process and clear the db in a separate part of the app, this count is just here here as a rough limit to // ensure that I don't keep pushing data into storage if, for some reason, it is not getting cleared elsewhere if (rowCount < 500) { await set(storeName, value, key) } } catch (error) { // error reported to error monitoring tool } } Some of the things I have tried to replicate (on Instagram webveiw, iOS 14.7.1 or Mobile Safari 14.6): saving a massive object to idb and closing or backgrounding Instagram or Safari mid transaction saving a massive object to idb across multiple Safari tabs at the same time manually deleting idb db from Safari while transaction is in progress - seems to generate either "UnknownError: * Connection is closing." or "AbortError: The transaction was aborted, so the request cannot be fulfilled." - both caught by try/catch Safari incognito Setting Safari privacy to store no cookies (or any other form of browser storage) this transaction lifetime bug https://github.com/jakearchibald/idb#transaction-lifetime ... Google - nothing for this error other than the webkit source code. Any suggestions appreciated. I'd like to understand particularly how it is triggered in the iOS webview (Instagram) as these errors are not caught by try/catch currently.
Posted
by
Post marked as solved
1 Replies
1.2k Views
The following way of setting the background color of an anchor tag in Safari on iOS 15 isn't working: <html> <head></head> <body><p><a class="content" href="#"><strong><span>Some content with background</span></strong></a> </p> <br /> <button onclick="javascript:onClick();">Click me to change content's background color</button> <script> function onClick(){ var element = document.getElementsByClassName('content')[0]; element.style.backgroundColor = "#888888"; } </script> </body> </html> I had to run the following hack after setting the backgroundColor in order for it to work: // Temporary workaround to redraw the element: var disp = element.style.display; element.style.display = 'none'; var trick = element.offsetHeight; element.style.display = disp; Video demonstration: https://www.dropbox.com/s/2z4kmsypj4ov4sd/iOS%2015%20webkit%20bug.mov?dl=0 Surely this is a bug in Safari unless I might've missed something?
Posted
by
Post not yet marked as solved
1 Replies
1.6k Views
After I install Java on my Mac I am getting the below error when I try to check the Java version.  % java -version    rosetta error: /var/db/oah/223263137464320_223263137464320/b0347cf8ea34da6748ab1aa2798ae3173ec7284920af0dc3926a4f3708749972/java.aot: attachment of code signature supplement failed: 1 zsh: trace trap  java -version
Posted
by
Post not yet marked as solved
2 Replies
376 Views
I´ve build an app that gets metrics (amount of downloads) from Appstore Connect, every time a website is opened (this will happen every hour when own build endpoint /metrics is opened). Everything is working, except one thing. The Token has an max duration of 20 Minutes. Which is no problem because my app is creating a new one every time the site is called. But I get an 401 Error not authorized, even though a new token is generated after 20 minutes when the app is running and is calling for data again. I am assuming the app is using the old token to verify and ends up in a loop. how to force the app to use the new token when the function is called again (/metrics is opened) instead of the old token?
Posted
by
Post not yet marked as solved
0 Replies
319 Views
I'm having some issues with iOS 15.0.2 version. I added video to my website as a background. So I put it style with fixed position via CSS. But it doesn't showing on iPhone with iOS 15.0.2 version. It's working well on other devices and iPhone with other version except 15.0.2. I tried adding fixed position via JavaScript but it still doesn't work. Whenever I changed position to other values like static or relative, the video was playing well. I can't find any solutions to fix it.
Posted
by
Post not yet marked as solved
0 Replies
393 Views
I have read that localStorage is a temporary data function(I didn’t even know that since iOS 5.1…) and I was surprised that it deleted all data. Anyways, is it a way to make be there as long as user wants(like on Windows or other devices)? Also here’s link to code that are on GitHub.
Posted
by
Post not yet marked as solved
0 Replies
235 Views
Hi, I'm new in coding, I hope that I'm not asking a dumb question. I'm coding an app and it requires getting data from a dynamic web pages like getting the prices of products, etc. Is it possible to do so or I'm wasting my time? cause I searched for a tutorial but I couldn't find anything.
Posted
by
Post not yet marked as solved
0 Replies
334 Views
i have the following javascript codes. they work on chrome but a bit weird on safari: document.myform.submit(); tried to debug and found that it stopped at the above line for safari. but interesting is that after reloading the page the page asked if i'd like to save password. then re-running the codes and everything worked again so i tried to rewrite the codes as below: document.getElementsByName("myform")[0].submit(); and it worked without any problem. for the first method, it's been used for many years and didn't have any problems. but curious whether it's caused by recent updates to the safari
Posted
by
Post not yet marked as solved
2 Replies
516 Views
Greetings, I have an app that relies on WKWebView and it works fine in iOS 15.1. However I've noticed that the WKWebView hangs in all the iOS 15.2 betas after approximately 20 seconds. At this point my only recourse is to recreate the WKWebView, as it no longer accepts any javascript. The remainder of the app behaves normally. Has anyone else experienced this and have any suggestions? My app updates the WKWebview approximately every second. However even without updating it, interacting with javascript running on it also causes it to lock up. Hitting the pause button on Xcode reveals that the JavaScriptCode malloc scavenger's last instruction is 0_psynch_cwait, but then again pausing the app when the WKWebView is not hanging reveals the same so, it's not a good clue. Thank you, SalCat
Posted
by
Post not yet marked as solved
5 Replies
457 Views
Hello! I would like to a deploy a program (more on which later) to the Apple Store, and I have a couple of questions regarding Apple Pay API usage. My product will be a paid program, and I have some problems with the Apple Pay API due to technical reasons. My program is an "Electron-like" application, it consists of two parts, backend, and UI. The "Backend" runs directly in the user's computer, it's written in Python and Flask. The "UI" is actually a browser that opens a webpage from the "Backend", and interacts with it using AJAX. The issue here is that I don't understand how in-app payments can be implemented. As far as I understand, the only option to deploy a paid application and the Apple Store is to use Apple Pay API, which is only available from Swift or Objective-C. I don't understand how can I use Apple Pay API, how I can check for a valid payment, etc. Can you please send me some kind of guide, tutorial, or instruction that can help me to use Apple Pay in my program? Thank you very much, Alex.
Posted
by
Post not yet marked as solved
0 Replies
719 Views
Hi guys, I have built a PWA that calls the javascript API navigator.geolocation.getCurrentPosition which prompts the user for location access when the Safari permission is set to Ask. This is the correct behavior and works as expected when open in Safari. However when added to the Home Screen and running with a display mode of "standalone", the location alert does not open on my phone (iPhone 13 mini / iOS 15.1.1). And the call never times out. Then if I switch from the PWA to Safari the location alert / prompt is suddenly showing in Safari. So it seems that the alert is targeting the wrong "tab". This does not happen if the PWA display mode is "browser" or "mimimal-ui" with either of those it behaves normally. I can only replicate this on my phone (iPhone 13 mini / iOS 15.1.1). I have also tested on various older phones (15.1.1 and 14.7) as well as several emulators and they all behave as expected. It is possible this is a obscure setting on my phone but it does feel a lot like an iOS Safari bug.
Posted
by
Post not yet marked as solved
0 Replies
368 Views
Hey everyone, sorry for my English. I have a website that give me one time code until iOS 15 its work with the auto-fill now its not work any more just in iOS 14.8 and below I give to my input a attribute autocomplete="one-time-code" there is something I need to change to make this work with iOS 15?
Posted
by