iphone - Javascript differences between Mobile Safari and Safari on Mac? - Stack Overflow

admin2025-04-21  0

Hey this question is pretty general, but I'm wondering what the Javascript differences are in Mobile Safari and Safari for Mac.

I was under the impression that from a Javascript perspective they are the same, with only some differences in CSS/rendering. But I am experiencing a number of Javascript errors in Mobile Safari that don't exist in regular Safari on Mac.

Basically a number of calls to certain jQuery plugins are returning undefined values (according to the developer debugger in Mobile Safari).

The website that I'm experiencing these issues on has a very lousy front end that is riddled with validation errors, lousy JS and has an enormous amount of CSS attached. I have no doubt that this issue lies somewhere in this code, and I've never experienced issues like this before.

I'm just having trouble honing in on the problem, so any insight/links as to the general differences in Javascript engines would be much appreciated.

Hey this question is pretty general, but I'm wondering what the Javascript differences are in Mobile Safari and Safari for Mac.

I was under the impression that from a Javascript perspective they are the same, with only some differences in CSS/rendering. But I am experiencing a number of Javascript errors in Mobile Safari that don't exist in regular Safari on Mac.

Basically a number of calls to certain jQuery plugins are returning undefined values (according to the developer debugger in Mobile Safari).

The website that I'm experiencing these issues on has a very lousy front end that is riddled with validation errors, lousy JS and has an enormous amount of CSS attached. I have no doubt that this issue lies somewhere in this code, and I've never experienced issues like this before.

I'm just having trouble honing in on the problem, so any insight/links as to the general differences in Javascript engines would be much appreciated.

Share Improve this question asked Jul 8, 2010 at 17:09 Jon RaaschJon Raasch 3,9937 gold badges32 silver badges32 bronze badges 1
  • As drawnonward said, problems are going to be caused by DOM/BOM differences more than differences in the JS engine itself. But let's have those—useful to know, especially when Mobile Safari is not freely available for everyone to test. – bobince Commented Jul 8, 2010 at 18:04
Add a ment  | 

2 Answers 2

Reset to default 2

Javascript itself, the core language, is no different. There are a few significant differences in the DOM that appear undocumented, but mostly it is all the same. Here you can see some differences in events that you can handle.

The DOM differences I noticed had to do with measuring elements. For example getClientRects, at least for a Selection or Range, was not available. There are probably other things.

Before I add my two cents about differences in Safari depending on environment or build: the list of possible environments for Safari is bigger than just iPod, iPhone, iMac.

I am also dealing with: Safari for Windows (desktop) and Mobile Safari in iOS Simulator on iMac.

My jQueryMobile + PhoneGap app works nicely in Safari for Windows (desktop) and Safari on iMac, but it has the following problems in Safari on iOS Simulator on iMac Snow Leopard with XCode 3.x:

  1. Google Analytics gets a "whitelist rejection" in iOS simulator.
  2. My app hangs early on in the user's setup process through another problem

That other problem could be any of:

  1. tags placed after element may not be loading properly
  2. calls to localDb may not be ing through
  3. jQuery's events (pageinit,click,etc) may not e though in the same way
转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1745211176a290578.html

最新回复(0)