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 working browsers. SyntaxError: Invalid regular
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 Safari whereas in
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? Answer
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 before in a non-captured group, and then extract only the first group (the
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’t work here. This code is being called upon clicking a picture,
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 the element and scroll to it. Here
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 scrolling if I set both html
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 event.returnValue, but now it seems they are not working anymore. So, how to
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 and Android devices. Safari won’t play
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. On Safari, it chooses not to display with the person-friendly formatting we’re used to. It