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

16488 questions
701
votes
19 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
  • 7,400
  • 6
  • 22
  • 21
642
votes
7 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
  • 6,701
  • 5
  • 17
  • 13
434
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,551
  • 2
  • 5
  • 7
374
votes
24 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
  • 74,658
  • 20
  • 105
  • 133
282
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,207
  • 5
  • 18
  • 10
253
votes
28 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,049
  • 7
  • 37
  • 51
218
votes
18 answers

is there a css hack for safari only NOT chrome?

im trying to find a css hack for just safari NOT chrome, i know these are both webkit browsers but im having problems with div alignments in chrome and safari, each displays differently. i have been trying to use this but it affects chrome as well,…
Bear John
  • 2,497
  • 5
  • 19
  • 22
198
votes
19 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
  • 6,892
  • 12
  • 45
  • 82
178
votes
5 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
  • 2,334
  • 2
  • 13
  • 19
169
votes
27 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:
164
votes
10 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,024
  • 14
  • 45
  • 70
162
votes
12 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
  • 1,865
  • 2
  • 13
  • 14
161
votes
2 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,574
  • 3
  • 17
  • 28
155
votes
20 answers

iPhone Safari Web App opens links in new window

I have problem with web after adding icon to Home Screen. If the web is launched from Home Screen, all links will open in new window in Safari (and lose full screen functionality). How can I prevent it? I couldn't find any help, only the same…
Pavel Linkesch
  • 3,516
  • 3
  • 19
  • 23
154
votes
19 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,141
  • 3
  • 24
  • 21
1
2 3
99 100