Questions tagged [safari]

Safari is Apple's web browser, the default browser on macOS and iOS.

Safari is the web browser bundled with iOS and macOS, operating systems from Apple. Previously, Windows was a supported platform but was discontinued after version 5.

Safari uses the WebKit rendering engine and the JavaScript Core JavaScript engine.

For Safari for iOS devices, there is the tag.

Documentation

17726 questions
778
votes
21 answers

How to remove the border highlight on an input text element

When an HTML element is 'focused' (currently selected/tabbed into), many browsers (at least Safari and Chrome) will put a blue border around it. For the layout I am working on, this is distracting and does not look right.
user170579
  • 8,180
  • 6
  • 24
  • 21
742
votes
8 answers

What is the difference between screenX/Y, clientX/Y and pageX/Y?

What is the difference between screenX/Y, clientX/Y and pageX/Y? Also for iPad Safari, are the calculations similar as on desktop—OR there is some difference because of viewport? It would be great if you could point me to an example.
hmthr
  • 7,711
  • 5
  • 19
  • 13
435
votes
4 answers

Array state will be cached in iOS 12 Safari. Is it a bug or feature?

Update at 2018.10.31 This bug has been fixed in iOS 12.1, have a good day~ I found a problem with Array's value state in the newly released iOS 12 Safari, for example, code like this:
abelyao
  • 1,571
  • 2
  • 7
  • 7
411
votes
25 answers

How to disable phone number linking in Mobile Safari?

Safari on iPhone automatically creates links for strings of digits that appear to the telephone numbers. I am writing a web page containing an IP address, and Safari is turning that into a phone number link. Is it possible to disable this behavior…
benzado
  • 82,288
  • 22
  • 110
  • 138
287
votes
7 answers

How to detect if the OS is in dark mode in browsers?

Similar to "How to detect if OS X is in dark mode?" only for browsers. Has anyone found if there is a way to detect if the user's system is in the new OS X Dark Mode in Safari/Chrome/Firefox? We would like to change our site's design to be dark-mode…
funkju
  • 3,463
  • 2
  • 15
  • 19
281
votes
30 answers

Get the real width and height of an image with JavaScript? (in Safari/Chrome)

I am creating a jQuery plugin. How do I get the real image width and height with Javascript in Safari? The following works with Firefox 3, IE7 and Opera 9: var pic = $("img") // need to remove these in of case img-element has set width and…
Frank Bannister
  • 3,197
  • 5
  • 20
  • 10
279
votes
22 answers

Is there a way to apply styles to Safari only?

I'm trying to find a way to apply CSS just to Safari, but everything I find also applies to Chrome. I know these are currently both WebKit browsers, but I'm having problems with div alignments in Chrome and Safari; each displays differently. I have…
Bear John
  • 3,135
  • 7
  • 21
  • 22
275
votes
23 answers

Invalid date in safari

alert(new Date('2010-11-29')); chrome, ff doesn't have problems with this, but safari cries "invalid date". Why ? edit : ok, as per the comments below, I used string parsing and tried this : alert(new Date('11-29-2010')); //doesn't work in…
Shrinath
  • 7,888
  • 13
  • 48
  • 85
265
votes
33 answers

How can I force WebKit to redraw/repaint to propagate style changes?

I have some trivial JavaScript to effect a style change: sel = document.getElementById('my_id'); sel.className = sel.className.replace(/item-[1-9]-selected/,'item-1-selected'); return false; This works fine with the latest versions of FF, Opera and…
danorton
  • 11,804
  • 7
  • 44
  • 52
235
votes
9 answers

Testing web application on Mac/Safari when I don't own a Mac

Having been caught out recently when a web site I launched displayed perfectly on IE, Firefox, Chrome and Safari on Windows but was corrupted when viewed using Safari on the Mac (by a potential customer), I need to start testing how my sites look…
SimonF
  • 2,595
  • 2
  • 16
  • 14
234
votes
33 answers

Video auto play is not working in Safari and Chrome desktop browser

I spent quite a lot of time trying to figure out why video embedded like here:
188
votes
3 answers

What does the shrink-to-fit viewport meta attribute do?

I'm having trouble finding documentation for this. Is it Safari specific? There was a recent bug in iOS 9 (here), the solution to which is adding shrink-to-fit=no to the viewport meta. What does this code do?
755
  • 2,991
  • 3
  • 20
  • 34
181
votes
11 answers

Swift Open Link in Safari

I am currently opening the link in my app in a WebView, but I'm looking for an option to open the link in Safari instead.
Fabian Boulegue
  • 6,476
  • 14
  • 47
  • 72
171
votes
5 answers

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?
techguy2000
  • 4,861
  • 6
  • 32
  • 48
168
votes
18 answers

iPad Web App: Detect Virtual Keyboard Using JavaScript in Safari?

I'm writing a web app for the iPad (not a regular App Store app - it's written using HTML, CSS and JavaScript). Since the keyboard fills up a huge part of the screen, it would make sense to change the app's layout to fit the remaining space when the…
LKM
  • 4,351
  • 3
  • 27
  • 22
1
2 3
99 100