开发者

Incorrect touch events from Android's browser with Dashcode mobile projects

I'm developing an HTML/Javascript mobile web application using Dashcode. Normally I wouldn't use such WYSIWYG stuff, but I've found it a very rapid development process.

Unfortunately it seems 开发者_如何学Golike I can't get it to run on Android's browser currently. The main display loads and all the correct data is pulled from web services, but you cannot press on anything to activate it.

I suspect that the android browser is sending different javascript events, which the Dashcode objects are not configured to pick up.

In addition, the adb logcat debugger refuses to output any log messages from the browser on the emulator, and as such I'm having a very hard time sorting this out.

So my question is: Can someone help me find out what events I need to be watching for, so I can iterate over all the touch handlers and duplicate them for the android events, or offer help in any other way on this situation?


I ran into this exact same problem also with my Dashcode applications. On the other, my jqTouch applications work on the Android broswer perfectly - exactly the same way they do on iPhone (Mobile Safari).

This made me wonder: How does jqTouch register to click/tap/whatever user events differently than Dashcode? If someone can answer this question we might be half way to the solution...


With regard to, at least, onClick event I had similar problems. Try erasing ALL data from deploy folder. I also used inline style to fire 'onclick' method like this:

                <div id="subscribeSubscriptionBtn" apple-part="com.apple.Dashcode.part.pushbutton" class="apple-no-children button" onclick="btnHandler(event);"></div>

this worked for me on iPhone and Android 2.1 device (preinstaled browser and FF). hope that helps...


I just wrestled with this and think I have it sorted.

The problem is in the Dashcode javascript frameworks' browser sniffing.

In Parts/core/core/base.js, line 47:

MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)

In Parts/core/views/Page.js, line 581:

if (!DC.Browser.MobileSafari)
{
      document.addEventListener('click', wrapEventHandler("_onclick"), false);
      document.addEventListener('dblclick', wrapEventHandler("_ondblclick"), false);
}

Dashcode incorrectly identifies the Android browser as Mobile Safari, since it's user agent looks something like: Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1

The result is Dashcode failing to attach its click and dblclick event listeners.

Changing line 47 of Parts/core/core/base.js to this fixes it:

MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) && !!!navigator.userAgent.match(/Android/)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜