Skip to content
Advertisement

Tag: safari

Jquery/Javascript – Regex – Error only in Safari browser

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

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

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

Advertisement