JavaScript

RSS for tag

Discuss the JavaScript programing language.

JavaScript Documentation

Posts under JavaScript tag

66 Posts
Sort by:
Post not yet marked as solved
0 Replies
398 Views
what happened? i never noticed it until i decided to use ipad air and pro as option in chrome dev console mobile view as well as ios simulator. it works ok in the ipad mini. touch events do not get triggered. instead, the scroll seems to overlap these. EDIT: Solved. please see comment below. While it works ok in ipad pro devices now, I still wish this could work out in chrome's dev console ipad pro view. the behavior is different with click events. instead of mouse down, it starts with mouse move. what gives? this only happens in ipad air and pro view in the device toolbar in dev console.
Posted
by chitgoks.
Last updated
.
Post not yet marked as solved
0 Replies
382 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 Last updated
.
Post not yet marked as solved
0 Replies
525 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 Last updated
.
Post not yet marked as solved
1 Replies
486 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 Last updated
.
Post not yet marked as solved
1 Replies
379 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 Last updated
.
Post not yet marked as solved
0 Replies
841 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 omri_pm.
Last updated
.
Post not yet marked as solved
0 Replies
684 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 Sergei27.
Last updated
.
Post not yet marked as solved
25 Replies
5.3k Views
Open music.yandex.ru Open browser console Paste this code: navigator.mediaSession.metadata = new MediaMetadata({ title: "11111111111", artist: "222222222", album: "3333333333", artwork: [ { src: "https://avatars.yandex.net/get-music-content/5375761/c8e05100.a.19837155-1/200x200" } ]}); Open Now playing widget. Title, artist, album is set correctly. Cover not set. macOS 13.0.1 (22A400) Safari 16.1 (18614.2.9.1.12) Note! In macOS 12.6.1 Safari 15.6.1 (17613.3.9.1.16) all works as expected.
Posted
by Mr.Moro.
Last updated
.
Post not yet marked as solved
2 Replies
583 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 Last updated
.
Post not yet marked as solved
1 Replies
599 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 codebox23.
Last updated
.
Post not yet marked as solved
0 Replies
349 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 sanguk.
Last updated
.
Post not yet marked as solved
0 Replies
512 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 sanguk.
Last updated
.
Post not yet marked as solved
0 Replies
319 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 sonnh96.
Last updated
.
Post marked as solved
4 Replies
1.7k Views
I'm using manifest v3 and working on a Safari extension. When I try to run a function within activeTab. I can not get the proper return from the the function. For example: browser.scripting.executeScript({ target:{tabId:tab.id}, func:()=>'test', }).then(result=>{ console.log('result',result) }) Here the result is always null. Is it a bug? Nothing wrong with permission settings because if I use files instead of func, the return value works properly. Safari: Version 16.1 (18614.2.3.1.1) macOS 13.0 Beta Xcode: Version 14.0 beta 5 Thanks
Posted
by Zijar.
Last updated
.
Post not yet marked as solved
1 Replies
1.4k 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 botsman.
Last updated
.
Post not yet marked as solved
1 Replies
383 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 Last updated
.
Post not yet marked as solved
2 Replies
1.5k Views
I would like to create a web app where you can drag and drop emails from Apple Mail (on macOS). When you drag emails to the desktop an .eml file is created, but when you drag emails to the browser no file is being transferred, I can only get the mail’s subject. So is it possible to drag and drop emails from Apple Mail to browsers? And if yes, then how? So far I've tried chrome and safari, but neither got any files with the dragged element. On windows with outlook or thunderbird this wasn’t an issue, so I hope it can be done with apple mail as well. Thanks in advance
Posted Last updated
.
Post not yet marked as solved
7 Replies
1.5k Views
I am currently facing an issue with PWA (Progressive Web App) push notifications on iOS and would greatly appreciate your assistance in resolving it. The problem I am experiencing is that when attempting to open a specific link from the notificationclick method using clients.openWindow('/messages'), the expected redirection to the "messages" page does not occur. Instead, the PWA opens without navigating to the desired destination. I want to emphasize that this issue is unique to iOS devices. If you have encountered a similar issue or have any suggestions on how to resolve it, please share your thoughts. Thank you in advance for your support and valuable suggestions.
Posted
by vansegena.
Last updated
.
Post not yet marked as solved
0 Replies
525 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 kekuuuuu.
Last updated
.
Post not yet marked as solved
0 Replies
552 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 kekuuuuu.
Last updated
.