Used below JS script with regex. To allow only numbers in input field. To change currency value with comma like 1,000 or 1,00,000 on user type value in input. Below codes working in all major browser expect in safari. Getting this error only in safari. Not sure how to fix this regex without affecting other wo…
Tag: safari
Audio Output Device Array is of length 0 on safari
I am working on a video conferencing app that leverages Amazon Chime. I have followed the npm page of Amazon Chime SDK JS and managed to get the server response and initialized the meetingSession. However, the problem is when I try to get an array of audio output devices, it is an array of length zero on Safa…
getCurrentPosition in JS does not work on iOS
I have a page that contains a code that gets the current location from the device and load other stuff based on the location with this code: It works on all android devices that I tested, but on iOS and macOS, it’s not working. Neither if nor else. Seems like it stuck at getting the current location. Any help…
Works in Chrome, but breaks in Safari: Invalid regular expression: invalid group specifier name /(?<=/)([^#]+)(?=#*)/
In my Javascript code, this regex /(?<=/)([^#]+)(?=#*)/ works fine in Chrome, but in safari, I get: Invalid regular expression: invalid group specifier name Any ideas? Answer Looks like Safari doesn’t support lookbehind yet (that is, your (?<=/)). One alternative would be to put the / that comes b…
javascript file input onchange not working [ios safari only]
The code below works everywhere except on safari mobile. Apparently the onchange is never triggered. I have found similar examples however they all refer to scenarios where there is even a form of some other visible representation of the file input and they all involve form-clearing workarounds. That wouldn&#…
Mobile Safari, scrollIntoView doesn’t work
I have a problem with scroll to element on mobile Safari in iframe (it works on other browsers, including Safari on mac). I use scrollIntoView. I want to scroll when all content has been rendered. Here is my code: Answer ScrollIntoView does not work (currently). But you can manually calculate the position of …
iOS 10 Safari: Prevent scrolling behind a fixed overlay and maintain scroll position
I’m not able to prevent the main body content from scrolling while a fixed position overlay is showing. Similar questions have been asked many times, but all of the techniques that previously worked do not seem to work on Safari in iOS 10. This seems like a recent issue. Some notes: I can disable scroll…
Is it possible to display a custom message in the beforeunload popup?
When using window.onbeforeunload (or $(window).on(“beforeunload”)), is it possible to display a custom message in that popup? Maybe a small trick that works on major browsers? By looking at existing answers I have the feeling this was possible in the past using things like confirm or alert or even…
Cropping with drawImage not working in Safari
I’m working on some simple image manipulation functions with canvas. The user uploads an image, is able to rotate and crop it and then clicks ok. The image is then split in half with each half drawn mirrored to two canvas elements, like this: Original Mirrored It all works great in Chrome, Firefox, IE a…
toLocaleString() doesn’t work in Safari browser
I used toLocaleString() method to input money comma in `javascript. But the problem is, IE and chrome browser result correctly except Safari browser. I delete cache several times but still doesn’t work. Answer The issue here is that number.toLocaleString is implemented differently on different browsers.…