JavaScript

RSS for tag

Discuss the JavaScript programing language.

JavaScript Documentation

Posts under JavaScript tag

65 Posts
Sort by:
Post not yet marked as solved
0 Replies
420 Views
When javaScript calls to navigator.mediaDevices.getUserMedia using {video: true, audio: true } constraints, throws an error: error: OverconstrainedError constraint: "" message: "Invalid constraint" name: "OverconstrainedError" Same result when constraints has video: true and audio: false You can test it easily opening the webRTC github samples: https://webrtc.github.io/samples/src/content/devices/multi/ https://webrtc.github.io/samples/src/content/getusermedia/gum/ This works fine on IOS16
Posted
by
Post not yet marked as solved
0 Replies
570 Views
Add to apple calendar is not working react PWA app on iPhone I have developed react PWA app reactjs - v16.14.0 and testing in my iphone13. I have used **npm library ** which opens google,outlook, apple calender event properly on android device, on IOS google and outlook works fine but add to apple calendar event doesnt not show any popup or not showing any error. I have reported one issue on this library forum but they have mentioned that Apple blocks the dynamic generation of ics files I am looking for resolution for this. Let me know proper way to add event in apple calender considering javascript library. [Edited by Moderator]
Posted
by
Post not yet marked as solved
1 Replies
403 Views
Hello, Here's some sample Javascript code: if (window.ApplePaySession) { console.log('ApplePaySession is available'); console.log('canMakePayments: ' + ApplePaySession.canMakePayments()); ApplePaySession.canMakePaymentsWithActiveCard(merchantId) .then(function(canMakePayments) { console.log('canMakePaymentsWithActiveCard: ' + canMakePayments); }); } else { console.log('ApplePaySession is not available'); } I'm logged into macOS with a sandbox test account that has Apple Pay permissions. The merchantId value is the one listed with my merchant ID. I'm running this locally. canMakePayments returns true, but canMakePaymentsWithActiveCard always returns false. I have two test cards setup in the macOS account's Apple Pay wallet, and both have a billing address setup. What can I do to troubleshoot why ApplePaySession.canMakePaymentsWithActiveCard is returning false?
Posted
by
Post not yet marked as solved
0 Replies
905 Views
Hi Safari team, I am a product manager working for a large content recommendation company. Our JavaScriot SDK is running on more than 9000 leading publishers worldwide and has been certified to be aligned with global legal and privacy regulations and guidelines. We have the following problem: Since the launch of Safari 17 (in iOS, iPadOS, and MacOS) - we can see our JavaScript SDK blocked when the user uses the private browsing mode Safari 17 sometimes identifies our loading and rendering JavaSctipt files as any request/action by our domain to be a tracking activity (we see the JavaScript files in the console tagged with “Blocked connection to known tracker” log) In previous Safari versions, we only got the tracking functionality blocked, allowing our content to render We have the following questions: Can JavaScript running in Safari detect the user has the privacy mode turned on? Was there something specific in Safari 17 “Tracking Protection” functionality that now blocks content rendering on the page in addition to tracking activity? Context: We can run our JavaScript without performing any form of tracking, either directly by my domain or any other 3rd party vendor we are working with. We will render our content without performing any form of tracking or fingerprinting We are already following Apple’s iOS IDFA guidelines. Our iOS SDK, for example, detects and respects when the user opts out from sharing the IDFA on an iOS app running our code. In that case, we show our content without breaching the App Tracking Transparency framework rules. Besides sponsored content, our JavaScript SDK also powers organic recommendations for our clients. With Safari 17 blocking anything in private browsing mode, we see unfair interference with organic engagement. Please let us know if you provide guidance to allow our JavaScript SDK to render content when the user uses the private browsing mode, adhering to the privacy requirements. Thank you for helping! Omri.
Posted
by
Post not yet marked as solved
1 Replies
512 Views
on our web pages we have allowed certain sources of scripts though content-security-policy meta tag which is working fine as expected on Chrome browser and on Internet Edge. However there is a script called morosa.top when it inserted in our html page, safari is not able to block it while it was supposed to block. if this script gets executed it start taking screenshots of screen and post it to hacker. Please check this could be a potential issue. [Edited by Moderator]
Posted
by
Post not yet marked as solved
1 Replies
467 Views
Any page that has a JavaScript function named "top()" in it causes JavaScript to fail. The function doesn't need to be called or even contain anything. eg. function top() { } JavaScript just locks up. This affects iOS17.2 and macOS 14.2 If occurs in Safari and any app using WKWebView This is a critical bug that affects sites and apps in the wild. I suggest there is something very wrong with the Javascript engine in general if certain function names can cause such a failure. Does anyone else have other function names that cause this failure?
Posted
by
Post not yet marked as solved
0 Replies
746 Views
Hi everyone, I hope this a right place to ask questions like this. I have an app which uses WEBGL scene implemented with three.js. At some point of loading, the app crashes (page reloads), which usually indicates that device ran out of memory reserved for this tab. This webgl scene however is fairly light compared to other scenes that load without any issues. How do I debug this? Is it possible to reallocate more memory before page is loaded, or is there a simple way to reduce memory consumption? I have very limited control over 3d scene, and it doesn't use heavy assets (mostly simple geometry with textures on them)
Posted
by
Post not yet marked as solved
0 Replies
370 Views
If you refresh the page after initially granting location permissions, you will be prompted for location permissions again and will need to grant permission again. Currently this only occurs on iOS. Is there a way? The tested iOS versions are 16.2 and 17. This is the code implemented when retrieving location information. <script> var options = { timeout: 15000, enableHighAccuracy: true, maximumAge: 86400000, }; function success(pos) { var crd = pos.coords; alert('Your current position is:'); alert(`Latitude : `+crd.latitude); alert(`Longitude: `+crd.longitude); }; function error(err) { alert(`ERROR(): `+err.message); }; navigator.geolocation.getCurrentPosition(success, error, options); </script>
Posted
by
Post not yet marked as solved
0 Replies
525 Views
If you refresh the page after initially granting location permissions, you will be prompted for location permissions again and will need to grant permission again. Currently this only occurs on iOS. Is there a way? I launched that web from app and the Safari settings didn't fix the issue. What should I do about this problem? The tested iOS versions are 16.2 and 17. This is the code implemented when retrieving location information. <script> var options = { timeout: 15000, enableHighAccuracy: true, maximumAge: 86400000, }; function success(pos) { var crd = pos.coords; alert('Your current position is:'); alert(`Latitude : `+crd.latitude); alert(`Longitude: `+crd.longitude); }; function error(err) { alert(`ERROR(): `+err.message); }; navigator.geolocation.getCurrentPosition(success, error, options); </script>
Posted
by
Post not yet marked as solved
1 Replies
639 Views
I have a website that makes heavy use of the web audio API, the site appears to be broken for all users who have upgraded to iOS 17 (I have verified it no longer works for 17.0.3 and does work for 16.3.1 It also works fine in macOS Safari and all other common desktop browsers that I have tested). I've created a simple test case page here to illustrate the problem: https://oldtime.radio/audio_test.html - clicking 'Play' downloads and plays audio in older iOS but nothing is played for iOS 17. There are no errors in the console so not much to go on. Is this a known bug. Code reproduced below in case folks don't want to click through to an unknown website: const btn = document.getElementById('btn'); btn.addEventListener('click', function() { const audio = new Audio(); audio.crossOrigin = "anonymous"; const AudioContext = window.AudioContext || window.webkitAudioContext, audioCtx = new AudioContext(), audioSrc = audioCtx.createMediaElementSource(audio); audioSrc.connect(audioCtx.destination); audio.addEventListener('canplaythrough', () => { audio.play(); }); audio.src = 'https://archive.org/download/Old_Radio_Adverts_01/OldRadio_Adv--1957_Chevrolet.mp3'; audio.load(); });
Posted
by
Post not yet marked as solved
0 Replies
336 Views
Hi guys I'm developing an extension for Safari using web browser api but Safari does not support management object and getSelft() function. Does anyone know how to check if the extension is installed in development mode? window.browser.management.getSelf(({ installType }) => { if(installType === "development") { // Do some stuff... } })
Posted
by
Post not yet marked as solved
2 Replies
621 Views
With a physical iPhone attached to the dev tools on my laptop, the memory usage of this web page https://nypost.com/2023/10/11/australian-swimmers-almost-walk-into-shark-as-it-swims-close-to-shore/ consistently grows until it reaches the memory limit of the device (in my case, about 1.5GB) The safari dev tools has a memory profiler timeline which breaks down memory usage into categories including "Javascript", "Layers", and "Page"; is there a way to break these down further to individual scripts/resources? I have also tried looking at the Javascript allocations profiler, but the computed heap size reported in its snapshots never comes anywhere close to the 700+ MB of "JavaScript" memory usage reported by the Memory profiler.
Posted
by
Post not yet marked as solved
1 Replies
1.5k Views
Recently I noticed that users with Safari 17 have some troubles using my website. I found out that the problem affects only users who use Safari in a private mode. After I dug deeper I realised that for some reason when I execute "window.location" for these users, query parameters do not present there even though they are actually present in the URL. For example, user is on the URL https://mywebsite.com/?code=TULEnfW1zRlqazI7XhM_QV7mxqPr-bV&state=5c5dbb2a-2332-4db7-a657-d2dc713d3e67 But the "window.location.search" returns an empty string. Also, the issue is only reproduced when user is actually redirected to the "broken" page, but it works fine if the user opens the page in a new tab. Issue is reproduced on both iOS and MacOS. I have a suspicion that the issue is somehow related to the recently added feature which prevents cross-site tracking, however, disabling that feature did not help. Does anyone aware of any recent changes to the behaviour of "window.location" in Safari? Thanks!
Posted
by
Post not yet marked as solved
1 Replies
409 Views
One time title was showing below the MarkerAnnotation and I noticed, that once it disappeared and now it is showing inside the marker if you click on it. Is it possible to move it back and show it below the marker? The field, that I am using for this purpose is called "title" navigator.userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
Posted
by
Post not yet marked as solved
0 Replies
542 Views
In my PWA app, I utilize the getUserMedia() API for accessing the camera and also employ HTML audio tags to handle various types of media content. However, since updating to iOS 17, I've encountered an issue where, after granting permission for camera access, audio playback occurs through the earpiece instead of the media speaker. This problem is specific to iOS 17; earlier iOS versions work as expected. My app is developed using a stack that includes JavaScript, Angular, Ionic, HTML5, and CSS. Can you please provide guidance or a solution to address this issue and ensure that audio plays through the media speaker when using the camera on iOS 17?
Posted
by
Post not yet marked as solved
0 Replies
565 Views
In My PWA app I am using camera of getUserMedia() and html audio tags, So In my app I am using videos audios and camera based on requirements, so When I have updated iOS17 I have stared facing below issue. When I am loading camera after premission given. my audios are playing in ear speaker and not in media speaker only for ios17, older ios versions it is working fine. I am using javascript, angular, ionic with html5 css for developing my app. Please provide solution.
Posted
by
Post not yet marked as solved
0 Replies
365 Views
I am trying to locate information or documentation on how to pull in photos from the iCloud Shared Albums, but have not been able to find anything yet. Dakboard is currently doing it so I know it is possible, but I cannot find an API or any documentation covering how to access the photos in a Shared Album for incorporation into web applications. Can anyone help?
Posted
by
Post not yet marked as solved
0 Replies
421 Views
We have a website running on Angular/CLI version 11.0.5. On iOS devices running iOS 17, we are encountering an issue where, after logging into our website, the screen becomes unresponsive, and no actions can be performed. The only functionality that remains is scrolling. This issue is specific to iOS 17; everything was working smoothly on iOS 16.6. In the browser console, we are seeing the following errors: ERROR: TypeError: e.reduceRight is not a function. (In 'e.reduceRight((e,t)=&gt;new P(e,t),this.backend)', 'e.reduceRight' is undefined) It's worth noting that this errors were also present in iOS 16.6, but the website was functioning correctly on those devices. However, in iOS 17, after a page refresh, the user can log in, but all subsequent pages become unresponsive. Before logging in, functions like signup and password reset work as expected. We are unsure about the changes made in iOS 17 that could be causing this issue.
Posted
by
Post not yet marked as solved
0 Replies
512 Views
I'm trying to read the clipboard data using the navigator.clipboard.readText() in the button click handler: <body> <h1>How to paste text</h1> <p><button type=button>Paste</button></p><textarea></textarea> <script> const pasteButton = document.querySelector("button"); pasteButton.addEventListener("click", (async () => { try { const e = await navigator.clipboard.readText(); document.querySelector("textarea").value += e; console.log("Text pasted.") } catch (e) { console.log("Failed to read clipboard. Using execCommand instead."); document.querySelector("textarea").focus(); const t = document.execCommand("paste"); console.log("document.execCommand result: ", t) } })); </script> </body> We can use the following link to check the demo page using the above code: https://web.dev/patterns/clipboard/paste-text/demo.html The demo page works fine when clicking the Paste button on the Chrome browser. But, it shows the Paste menu when clicking the Paste button on the Safari browser. Only when clicking the Paste menu on the Safari browser, the clipboard data is pasted into the text box. So, I'd like to know how to hide the "Paste" menu on Safari browser when using navigator.clipboard.readText() in the button click handler. Thanks.
Posted
by