All Questions

256
votes
30answers
355813 views

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

I am creating a jQuery plugin. How do I get real image width and height with Javascript in Safari? Following works with Firefox 3, IE7 and Opera 9: var pic = $("img") // need to remove these in of...
216
votes
22answers
147601 views

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 w...
53
votes
2answers
13882 views

Flexbox not working on button or fieldset elements

I'm trying to center inner elements of a <button>-tag with flexbox's justify-content: center. But Safari does not center them. I can apply the same style to any other tags and it works as intend...
60
votes
5answers
121339 views

Firing a Keyboard Event in JavaScript

I'm trying to simulate a keyboard event in Safari using JavaScript. I have tried this: var event = document.createEvent("KeyboardEvent"); event.initKeyboardEvent("keypress", true, true, null, false,...
70
votes
10answers
182802 views

jQuery .load() call doesn't execute JavaScript in loaded HTML file

This seems to be a problem related to Safari only. I've tried 4 on Mac and 3 on Windows and am still having no luck. I'm trying to load an external HTML file and have the JavaScript that is embedded...
106
votes
11answers
212581 views

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 ...
22
votes
1answers
22364 views

Is it possible to display a custom message in the beforeunload popup?

When using window.onbeforeunload (or $(window).on("beforeonload")), is it possible to display a custom message in that popup? Maybe a small trick that works on major browsers? By looking at existing...
303
votes
24answers
206754 views

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 numb...
48
votes
10answers
35727 views

JavaScript: Which browsers support parsing of ISO-8601 Date String with Date.parse

I failed to parse an ISO-8601 date "2011-04-26T13:16:50Z" on IE8 and Safari 5, but it worked on Chrome 10, FF4. Support seems to be quite mixed? Does anyone know the actual status of which browsers ...
418
votes
5answers
134915 views

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 i...

Previous Next