Are JavaScript getters/setters supported by Mobile Safari on the iPad? - javascript

I'm developing an iPad Web App for a client. Unfortunately I don't have an iPad to test the app, so I tried testing it on my iPhone. I entered the following URL in Mobile Safari and it alerted me that the method is undefined:
javascript:alert(Object.defineProperty);
I need to know however if it'll work on the iPad. Additional information about getter/setter support on the iPad is appreciated.

I've only tested 4.3, but it looks like it is supported for JS objects, but not DOM objects... just to be different from IE8 which is the opposite.
If you have access to OSX, I recommend downloading XCode --it comes with a useful iOS emulator for the various devices.
Also, this link might be useful, as it contains a table of ECMAScript 5 features, even though it does not mention the DOM restriction.
http://davidbcalhoun.com/2011/new-mobile-safari-stuff-in-ios5-position-fixed-overflow-scroll-new-input-type-support-web-workers-ecmascript-5

Related

Microphone access FIrefox and Chrome on iOS 12

In Safari it can be accessed via navigator.mediaDevices.getUserMedia(), but for Firefox and Chrome navigator.mediaDevices is undefined.
I know that Firefox is using WebView
Firefox docs
(Probably Chrome too), and it is supposed that these browsers will have the same javascript engine as Safari. Is this correct?
Maybe there is some HTML meta tag, which can enable access to media devices?
It still looks like that Apple has not given free the access to mediaDevices for other browser distributor on iOS (while it works on OSX for all browsers). By saying this not only microphone but also camera/video is not accessible for HTML pages.
I've done a lot of researches about this topic but couldn't find a clear statement or any other way how to do it in Chrome/FF on iOS 11.2+. Some information were just misleading.
I've just asked this question to the Mozilla community. Feel free to track it in hope for a clear answer: question here

Detecting browser versions on recent mobile devices

I have a need to differentiate between the native (Android) browser and Google Chrome on more recent Android devices, but keep running into problems, specifically with more recent Samsung devices (the Galaxy S4, Galaxy S4 mini and Galaxy Mega).
We have some device detection in-house which analyses the user agent sent from the browser to try and determine which browser is being used. Traditionally to detect Chrome, the code would look for either "Chrome" or "CriOS" within the user agent, normally these are present in the last part of the user agent string (according to the Wikipedia article on User agents, this is used to indicate available enhancements).
Up until very recently, this worked without issue*.
On the latest Samsung Galaxy devices (listed above) running Android 4.2.2, the native browser returns "Chrome" in the user agent string. From some brief reading around the subject, this is because the native browser uses Chromium (I'll admit, I didn't understand the differences between Chromium and Chrome until I read around the subject a bit, more info here).
This also invalidates the use of Chrome feature detection suggested here.
The main issue with this is that we're seeing minor rendering differences between the two browsers, which we'd normally handle with browser specific CSS hacks**, which we're now unable to use.
So far, we've only seen this issue on Samsung Galaxy devices, when tested on a Nexus 4 running Android 4.2.2, the native browser does not return Chrome as part of the user agent. It could be that this is a problem very specific to Samsung Galaxy devices running Android 4.2.2, but at this juncture, we don't have a broad enough range of devices to test on.
Does anyone know of any way of reliably differentiating between the two browsers without using either of the two methods above?
*that's without any issues that we've noticed or that have been reported to us.
**yes, I know using hacks isn't the best way of doing things, but when it's that or re-write large chunks of the code, hacks tend to win out.

javascript not working on native android browser

I am part way through developing a mobile web app which contains almost no HTML elements. JSON2HTML is used to create HTML elements.
My problem is that it works ok except for on
iPad
Android 4.0.3 Native browser.
The problem with these browsers is that the content isn't being rendered.
It works fine on
Android 4.0.3 Chrome,
Android 4.0.3 Firefox
Android 4.0.3 Opera
Android 4.0.3 Dolphin
Android 4.1.1 Native
Android 4.1.1 Other browsers
Just to clarify, this is a mobile web app, not a native mobile app. I am not using any native code, I am using standard web technologies (HTML5, CSS3, jQuery, Javascript, JSON)
After days of research and testing, I have found the solution.
First I activated the built-in debugger on my Android phone - instructions at http://tinyurl.com/768qltl
The debugger then told me that the error was at line 71 of jquery.json2html.js
I opened jquery.json2html.js
I replaced line 71 with the following code
else $.fn.append.call($(this),$(dom).children());
This works because the previous line 71 was calling the jquery append.apply function, which only works with specific data type on older browsers.
Your best bet would be finding a way to remotely debug what's happening in the native browser. There are a couple ways to do this.
Install an app like JsHybugger, which acts as a reverse proxy
Add some new JavaScript to the source page and use Weinre, JSConsole, or to attach remotely

is Mobilizer capable of emulating perfectly the behavior of scripts as well?

I recently took a look at Mobilizer http://www.springbox.com/mobilizer/
It's pretty amazing, being able to simulate the interfaces of iphones and stuff.
However, my question is that is it actually capable of rendering the exact same behavior not just for layout but for the javascript scripts?
I mean it will pretty hurt to find out that the script ran correctly in the emulator only to fail in the real scenario...
This program will not emulate the actual phone OS. As far as I can tell, it is just loading up the page in an internal (desktop based) browser and displaying it within the phone with the correct dimensions etc. It is probably sending the User Agent string that belongs to that device as well.
So, It is useful for testing your layout on different screen sizes, testing your mobile redirect scripts and saving out mockups of the website on a device for clients.
It is definitely not to be used to test if your website will work on that device.
To accurately test without a physical device on:
iOS, check out the iOS simulator that comes with X Code.
Android, check out the Android emulator that comes with the Android SDK.
WebOS, check out the WebOS emulator from the webOS SDK
Blackberry, check out the Blackberry Simulators (Windows only)
Unfortunately, there is no app that makes testing on all these devices easy as it seemed 'Mobilizer' did. If you can, it's always good to test on the actual devices too as emulators aren't always perfect.

Is the Android Emulator browser suitable and reliable for testing an HTML/Javascript Application?

I'm developing an HTML / Javascript application meant to run on an Android device running Froyo (2.2). Assuming I don't need multitouch functionality, will the emulator's browser be a reliable means of debugging HTML, CSS and Javascript? Or is it possible that I would work out all the bugs in the emulator but find the actual device handles things differently?
The underlying code for WebKit is identical in the emulator and the actual device. The only thing you need to worry about are the other components inbetween (some carriers have proxies, for example. I used to have problems with T-Mobile where it would simply send me a outdated cached version of a site instead of even contacting the site).

Categories

Resources