JavaScript

RSS for tag

Discuss the JavaScript programing language.

Posts under JavaScript tag

200 Posts

Post

Replies

Boosts

Views

Activity

Unable to get Sign In with Apple to work on Firebase
Hey all. So I'll keep it short. I registered by App Service ID and Key and everything. I even enabled Apple Sign in from Firebase and got sign in with Apple to work on my Swift iOS app. Now I want it to work on my web app via Vanilla Javascript. When I run the following code on my frontend after initiating firebase, I don't get anything. Like absolutely no error in console or any kind of pop up. I'd appreciate if someone could tell me what I'm doing wrong. Thanks in advance! const provider = new firebase.auth.OAuthProvider('apple.com'); firebase.auth().signInWithPopup(provider).then((result) => { /** @type {firebase.auth.OAuthCredential} */ var credential = result.credential; // The signed-in user info. var user = result.user; // You can also get the Apple OAuth Access and ID Tokens. var accessToken = credential.accessToken; var idToken = credential.idToken; // ... }) .catch((error) => { // Handle Errors here. var errorCode = error.code; var errorMessage = error.message; // The email of the user's account used. var email = error.email; // The firebase.auth.AuthCredential type that was used. var credential = error.credential; // ... }); // Result from Redirect auth flow. firebase.auth().getRedirectResult().then((result) => { if (result.credential) { /** @type {firebase.auth.OAuthCredential} */ var credential = result.credential; // You can get the Apple OAuth Access and ID Tokens. var accessToken = credential.accessToken; var idToken = credential.idToken; // ... } // The signed-in user info. var user = result.user; }) .catch((error) => { // Handle Errors here. var errorCode = error.code; var errorMessage = error.message; // The email of the user's account used. var email = error.email; // The firebase.auth.AuthCredential type that was used. var credential = error.credential; // ... }); }
0
0
1.4k
Jul ’22
Total canvas memory use exceeds the maximum limit - iOS 15 beta with Safari
With the latest iOS 15 beta releases we have started seeing issues with memory and canvases. This error is not reproduced in any of the earlier iOS versions (with any devices), it is only present in the new iOS 15 beta versions. The warning about total canvas memory is always followed with a javascript exception trying to do rendering on the canvas: This is an history of it working in a iPhone 12 pro max with iOS 14.7.1. This is history of it not working with an iPhone 11 with iOS 15 beta 5 (confirmed with beta 4 as well) There are a couple of observations we've made: It seems it is more easily reproduced by repeatedly triggering the new url bar and rotating the device a lot. Clearing History and Website Data can fix the issue temporarily When it is reproduced it can easily be reproduced again, even when reloading the page.
3
0
7.0k
Jul ’22
Java Virtual machine for Monterey
I want to install a GitHub repository and nvm command therefore I need the java virtual machine. When I check the "java -version in zsh I always get this Error Error: Could not create the Java Virtual Machine. What would you suggest since it is installed JavaVirtualMachines/jdk-18.0.1.jdk?
2
0
4.2k
Jun ’22
IOS 15: WebAuthn catches error but still prompts user
Hi. The registration process with WebAuthn works fine and expected. As we use the same code on both android and ios, we dont use discoverable credentials, but instead saves the credential-id in a cookie. If an user deletes his cookie, we can not see if the user has registered previously without prompting the user for registration again. This is okay, and if we get an InvalidStateError (because the user is already registered) we let the user think he has registered again, and just creates a new cookie. The problem is: When the navigator.credentials.create is called, the InvalidStateError is catched immideately, before the user have time to do anything about the faceID prompt which shows. When the InvalidStateError is caught, the Registration Completed page shows. This means the completed page is shown behind the face-id prompt, which is very confusing for the user. How can the registration be completed if the face-id prompt is not finished? On Windows, the error is not thrown before the user has completed the faceid prompt, which means the registration-process is experienced exactly as a first-time registration. Is it a bug that the prompt is shown after the error is thrown? Any tips to how i can work around this? If this is not the right forum to ask - where is a better place? Best regards, Nina
1
0
888
Jun ’22
[bug] iPad Safari fullscreen error when triggered following a pointerdown event
When triggering a webkitRequestFullscreen event in response to a pointerdown event, the result is a fullscreen error. Using a pointerup event instead of pointerdown works fine. I'm using a <button> element to receive the event and in the event listener callback I'm attempting to call webkitRequestFullscreen() on a div. Is this expected behavior? note: this was observed using MacOS Simulator: iPad 9th Generation - iOS 15.4
0
0
971
Jun ’22
How to make the button "Share to Instagram Story in Tik Tok?"
Hello, i would like to know if anyone knows how the Tik Tok button to works to share a video from this plataform in Instagram stories, that is, the button opens editing mode with the video already included. I would be needing to make a similar button for an application. i tried entering URLs from my phone like: "//instagram.com/create/story" but it doesn´t even open the story editing mode. Thank you very much.
0
0
722
Jun ’22
JavaScriptCore Date Constructor Works Differently than V8
Date objects should be able to be constructed with strings formatted as YYYY-MM-DD . On Chrome-based browsers, both of the following are valid: new Date("2022-06-01") new Date("2022-6-01") although the second one does not strictly follow the format. However, it is extremely convenient to work with since you do not have to check for the string length and determine whether to add a 0 in the beginning. Yet, on my Safari browser, the code: new Date("2022-6-01") returns a date object of an invalid date. This is simple to fix, yet it poses an inconvenience during development. Is there any way to let Apple improve its JavaScript engine?
1
0
1.3k
May ’22
Safari 15.4 window.open freezes both parent and child tabs
Hello Safari 15.4 window.open freezes both parent and child tabs Made a github page where you can reproduce the bug: https://swanty.github.io/pdfjs-safari/broken.html It happens only when special conditions are met: The broken.html page loads Stripe v3 js file (important for the freeze) Upon clicking CLICK ME the code executes window.open().location = '...';, thus both parent and child tabs are linked together in the same process The second page opens the latest release of mozilla pdf.js that loads .pdf that contains only 1 image (the image is important for the freeze) Image is simply 3000x3000 PNG, 1 color, 1.2 kB file created with photopea, nothing special, except the resolution. PDF I created by dragging the .png into Chrome and clicking Print -> Save as pdf, also nothing special, just a regular pdf. On our production web if I navigate pages in same tab and at any point that stripe JS is loaded and then I navigate to a different page where window.open().location = '...' opens that pdf.js + .pdf file with special image then both tabs freeze. It doesn't matter how many times I navigate the pages (in same tab), it seems that once the stripe js is loaded, it lingers in the tab memory somewhere and causes the freeze. I would really appreciate it if someone from the Safari developer team could take a look at this and help find a solution :) Thank you
2
0
2.4k
May ’22
Both app and pkg are notarized; app opens fine but pkg encounters javascript error
I have an app built using python with pyinstaller. I was able to successfully get the app notarized and open it on my computer as well as a different one (OS 11.6.1). I can also get the pkg successfully notarized, but when I attempt to launch it on my own computer (or a different one), an error box immediately appears stating "There was an error reading the package" along with "JavaScriptError." I looked at the log file corresponding to the notarization, and I saw no error messages or warnings. Neither "java" nor "javascript" appear anywhere. This was not a problem for me a couple weeks ago when using a slightly different version of my program. Is there a different log file of some type, associated with javascript, that might shed light on the problem? Update: I did just try to check whether package passed the gatekeeper test by typing spctl -a '/Users/..../application.pkg' at the terminal, which returned "rejected"
9
0
2.2k
May ’22
Choosing Audio Output of iPhone while using HTMLAudioElement.
I was working on a project where I used the HTMLAudioElement to record an audio response. While playing the audio on iPhone, I noticed that the sound came just from the ear speaker and not the loud speaker which is desired by the user. Is there a way to select the output to come out of the loud speaker as in the former case the user can't hear the preview audio properly?
2
1
947
May ’22
Access the UserDefaults from the safari extension background page
Hi, I am working on safari web extension for iOS, Since Message passing is only supported from safari extension to iOS application. To pass the data from app to safari extension, I thought of storing the required data using the Userdefault suite name and "app group" to access the UserDefaults data from the safari extension. I am stuck at how to access the data at the safari extension. Any sample javascript to access the UserDefaults data is appreciated Thanks
1
0
1.3k
May ’22
Disable auto focus (camera movement) when showing annotation on Mapkit JS
Hello, I would like to know if there is a way to disable the focus on a new added annotation on mapkit js. I have a loop that display annotation and every time the new annotation shows up, the map move the camera and set a super-dupper zoom on the new annotation. This is very annoying. Map initialisation : var map = new mapkit.Map("map", { region: region, showsCompass: mapkit.FeatureVisibility.Hidden, showsZoomControl: true, showsMapTypeControl: true, showsUserLocation: true, }); _ New annotation : chasseur = new mapkit.Coordinate(48.8607, 2.3421); ChasseurAnnotation = new mapkit.MarkerAnnotation(chasseur, { color: "#001788", title: "Chasseur", glyphText: "\u{1F6A8}" // POLICE }); map.showItems([ChasseurAnnotation]); _ Thanks a lot for your further responses.
2
0
1.2k
May ’22
dictate will continuously trigger 'input' DOM event
I want to get user's dictation content and do something. However, during dictation progress, system will continuously trigger 'input' DOM event with duplicated strings. It is impossible to know whether the dictation progress is end to get the final result. Several solutions here: provide specific field, like dictationStatus: end in input event params. trigger composition event instead of input event trigger specific DOM event when user presses on the dictation button. trigger input event only with latest recognized string. for example, I say " I like apple" will get 3 events with strings: "I" "like" "apple" ( not "I" "I like" "I like apple")
0
1
579
Apr ’22
Unable to get Sign In with Apple to work on Firebase
Hey all. So I'll keep it short. I registered by App Service ID and Key and everything. I even enabled Apple Sign in from Firebase and got sign in with Apple to work on my Swift iOS app. Now I want it to work on my web app via Vanilla Javascript. When I run the following code on my frontend after initiating firebase, I don't get anything. Like absolutely no error in console or any kind of pop up. I'd appreciate if someone could tell me what I'm doing wrong. Thanks in advance! const provider = new firebase.auth.OAuthProvider('apple.com'); firebase.auth().signInWithPopup(provider).then((result) => { /** @type {firebase.auth.OAuthCredential} */ var credential = result.credential; // The signed-in user info. var user = result.user; // You can also get the Apple OAuth Access and ID Tokens. var accessToken = credential.accessToken; var idToken = credential.idToken; // ... }) .catch((error) => { // Handle Errors here. var errorCode = error.code; var errorMessage = error.message; // The email of the user's account used. var email = error.email; // The firebase.auth.AuthCredential type that was used. var credential = error.credential; // ... }); // Result from Redirect auth flow. firebase.auth().getRedirectResult().then((result) => { if (result.credential) { /** @type {firebase.auth.OAuthCredential} */ var credential = result.credential; // You can get the Apple OAuth Access and ID Tokens. var accessToken = credential.accessToken; var idToken = credential.idToken; // ... } // The signed-in user info. var user = result.user; }) .catch((error) => { // Handle Errors here. var errorCode = error.code; var errorMessage = error.message; // The email of the user's account used. var email = error.email; // The firebase.auth.AuthCredential type that was used. var credential = error.credential; // ... }); }
Replies
0
Boosts
0
Views
1.4k
Activity
Jul ’22
Multiple redirection / http 302
An http post request that generates a redirect from one domain to another does not work on IOS but works on all other browsers. we have a 302 error. Any workarounds to this issue?
Replies
0
Boosts
0
Views
709
Activity
Jul ’22
Vimeo Javascript cuepoint events not firing on latest iOS 15.6
I have a quiz type one page website which uses Vimeo official embed player. After upgrading to iOS 15.6 it seems on Safari, Cuepoint events are not firing to IPhone 13 Pro Max (other iphones are working fine). It seems there are no JavaScript Errors on console. Has anyone else experienced it?
Replies
0
Boosts
0
Views
597
Activity
Jul ’22
Total canvas memory use exceeds the maximum limit - iOS 15 beta with Safari
With the latest iOS 15 beta releases we have started seeing issues with memory and canvases. This error is not reproduced in any of the earlier iOS versions (with any devices), it is only present in the new iOS 15 beta versions. The warning about total canvas memory is always followed with a javascript exception trying to do rendering on the canvas: This is an history of it working in a iPhone 12 pro max with iOS 14.7.1. This is history of it not working with an iPhone 11 with iOS 15 beta 5 (confirmed with beta 4 as well) There are a couple of observations we've made: It seems it is more easily reproduced by repeatedly triggering the new url bar and rotating the device a lot. Clearing History and Website Data can fix the issue temporarily When it is reproduced it can easily be reproduced again, even when reloading the page.
Replies
3
Boosts
0
Views
7.0k
Activity
Jul ’22
Strange Safari behaviour
Deleted for privacy and wrong section argument.
Replies
0
Boosts
0
Views
437
Activity
Jun ’22
Java Virtual machine for Monterey
I want to install a GitHub repository and nvm command therefore I need the java virtual machine. When I check the "java -version in zsh I always get this Error Error: Could not create the Java Virtual Machine. What would you suggest since it is installed JavaVirtualMachines/jdk-18.0.1.jdk?
Replies
2
Boosts
0
Views
4.2k
Activity
Jun ’22
IOS 15: WebAuthn catches error but still prompts user
Hi. The registration process with WebAuthn works fine and expected. As we use the same code on both android and ios, we dont use discoverable credentials, but instead saves the credential-id in a cookie. If an user deletes his cookie, we can not see if the user has registered previously without prompting the user for registration again. This is okay, and if we get an InvalidStateError (because the user is already registered) we let the user think he has registered again, and just creates a new cookie. The problem is: When the navigator.credentials.create is called, the InvalidStateError is catched immideately, before the user have time to do anything about the faceID prompt which shows. When the InvalidStateError is caught, the Registration Completed page shows. This means the completed page is shown behind the face-id prompt, which is very confusing for the user. How can the registration be completed if the face-id prompt is not finished? On Windows, the error is not thrown before the user has completed the faceid prompt, which means the registration-process is experienced exactly as a first-time registration. Is it a bug that the prompt is shown after the error is thrown? Any tips to how i can work around this? If this is not the right forum to ask - where is a better place? Best regards, Nina
Replies
1
Boosts
0
Views
888
Activity
Jun ’22
[bug] iPad Safari fullscreen error when triggered following a pointerdown event
When triggering a webkitRequestFullscreen event in response to a pointerdown event, the result is a fullscreen error. Using a pointerup event instead of pointerdown works fine. I'm using a <button> element to receive the event and in the event listener callback I'm attempting to call webkitRequestFullscreen() on a div. Is this expected behavior? note: this was observed using MacOS Simulator: iPad 9th Generation - iOS 15.4
Replies
0
Boosts
0
Views
971
Activity
Jun ’22
WKWebView javascript execution when app is in background
hello. Switch the app to background when loading a webpage in webview, webpage's JavaScript will stop working. Resume the app webpage fails to load and the screen is not drawn. Any solution?
Replies
0
Boosts
0
Views
683
Activity
Jun ’22
How to make the button "Share to Instagram Story in Tik Tok?"
Hello, i would like to know if anyone knows how the Tik Tok button to works to share a video from this plataform in Instagram stories, that is, the button opens editing mode with the video already included. I would be needing to make a similar button for an application. i tried entering URLs from my phone like: "//instagram.com/create/story" but it doesn´t even open the story editing mode. Thank you very much.
Replies
0
Boosts
0
Views
722
Activity
Jun ’22
JavaScriptCore Date Constructor Works Differently than V8
Date objects should be able to be constructed with strings formatted as YYYY-MM-DD . On Chrome-based browsers, both of the following are valid: new Date("2022-06-01") new Date("2022-6-01") although the second one does not strictly follow the format. However, it is extremely convenient to work with since you do not have to check for the string length and determine whether to add a 0 in the beginning. Yet, on my Safari browser, the code: new Date("2022-6-01") returns a date object of an invalid date. This is simple to fix, yet it poses an inconvenience during development. Is there any way to let Apple improve its JavaScript engine?
Replies
1
Boosts
0
Views
1.3k
Activity
May ’22
How can I check if the website is in WebClip mode?
I want that a JavaScript Check if the website was opened from safari or from a webclip. how can I?
Replies
0
Boosts
0
Views
659
Activity
May ’22
Multiple sliders not working on safari only.
We have implemented two sliders in a website "website url-Perennial? Seasonal? Always special (duckstein.de)". These slider are working properly on android devices and other windows browsers. But why these sliders are not working in safari? Please help on it for a solution.
Replies
0
Boosts
0
Views
861
Activity
May ’22
Safari 15.4 window.open freezes both parent and child tabs
Hello Safari 15.4 window.open freezes both parent and child tabs Made a github page where you can reproduce the bug: https://swanty.github.io/pdfjs-safari/broken.html It happens only when special conditions are met: The broken.html page loads Stripe v3 js file (important for the freeze) Upon clicking CLICK ME the code executes window.open().location = '...';, thus both parent and child tabs are linked together in the same process The second page opens the latest release of mozilla pdf.js that loads .pdf that contains only 1 image (the image is important for the freeze) Image is simply 3000x3000 PNG, 1 color, 1.2 kB file created with photopea, nothing special, except the resolution. PDF I created by dragging the .png into Chrome and clicking Print -> Save as pdf, also nothing special, just a regular pdf. On our production web if I navigate pages in same tab and at any point that stripe JS is loaded and then I navigate to a different page where window.open().location = '...' opens that pdf.js + .pdf file with special image then both tabs freeze. It doesn't matter how many times I navigate the pages (in same tab), it seems that once the stripe js is loaded, it lingers in the tab memory somewhere and causes the freeze. I would really appreciate it if someone from the Safari developer team could take a look at this and help find a solution :) Thank you
Replies
2
Boosts
0
Views
2.4k
Activity
May ’22
Both app and pkg are notarized; app opens fine but pkg encounters javascript error
I have an app built using python with pyinstaller. I was able to successfully get the app notarized and open it on my computer as well as a different one (OS 11.6.1). I can also get the pkg successfully notarized, but when I attempt to launch it on my own computer (or a different one), an error box immediately appears stating "There was an error reading the package" along with "JavaScriptError." I looked at the log file corresponding to the notarization, and I saw no error messages or warnings. Neither "java" nor "javascript" appear anywhere. This was not a problem for me a couple weeks ago when using a slightly different version of my program. Is there a different log file of some type, associated with javascript, that might shed light on the problem? Update: I did just try to check whether package passed the gatekeeper test by typing spctl -a '/Users/..../application.pkg' at the terminal, which returned "rejected"
Replies
9
Boosts
0
Views
2.2k
Activity
May ’22
Choosing Audio Output of iPhone while using HTMLAudioElement.
I was working on a project where I used the HTMLAudioElement to record an audio response. While playing the audio on iPhone, I noticed that the sound came just from the ear speaker and not the loud speaker which is desired by the user. Is there a way to select the output to come out of the loud speaker as in the former case the user can't hear the preview audio properly?
Replies
2
Boosts
1
Views
947
Activity
May ’22
Access the UserDefaults from the safari extension background page
Hi, I am working on safari web extension for iOS, Since Message passing is only supported from safari extension to iOS application. To pass the data from app to safari extension, I thought of storing the required data using the Userdefault suite name and "app group" to access the UserDefaults data from the safari extension. I am stuck at how to access the data at the safari extension. Any sample javascript to access the UserDefaults data is appreciated Thanks
Replies
1
Boosts
0
Views
1.3k
Activity
May ’22
Disable auto focus (camera movement) when showing annotation on Mapkit JS
Hello, I would like to know if there is a way to disable the focus on a new added annotation on mapkit js. I have a loop that display annotation and every time the new annotation shows up, the map move the camera and set a super-dupper zoom on the new annotation. This is very annoying. Map initialisation : var map = new mapkit.Map("map", { region: region, showsCompass: mapkit.FeatureVisibility.Hidden, showsZoomControl: true, showsMapTypeControl: true, showsUserLocation: true, }); _ New annotation : chasseur = new mapkit.Coordinate(48.8607, 2.3421); ChasseurAnnotation = new mapkit.MarkerAnnotation(chasseur, { color: "#001788", title: "Chasseur", glyphText: "\u{1F6A8}" // POLICE }); map.showItems([ChasseurAnnotation]); _ Thanks a lot for your further responses.
Replies
2
Boosts
0
Views
1.2k
Activity
May ’22
Download attribute not working in web extension popup
Hi in my web extension I have a button, which I programmatically create a file for download when the user clicks it. Here is my code: a.click() However, this does nothing when I do it within the popup. It works fine on the main Safari webpage. Am I doing something wrong?
Replies
2
Boosts
0
Views
2.1k
Activity
May ’22
dictate will continuously trigger 'input' DOM event
I want to get user's dictation content and do something. However, during dictation progress, system will continuously trigger 'input' DOM event with duplicated strings. It is impossible to know whether the dictation progress is end to get the final result. Several solutions here: provide specific field, like dictationStatus: end in input event params. trigger composition event instead of input event trigger specific DOM event when user presses on the dictation button. trigger input event only with latest recognized string. for example, I say " I like apple" will get 3 events with strings: "I" "like" "apple" ( not "I" "I like" "I like apple")
Replies
0
Boosts
1
Views
579
Activity
Apr ’22