Blackbing Playground

Javascript in IE Mobile 6.0


  1. Is Ajax support on Internet Explorer Mobile?

    Actually, IE Mobile’s Ajax support dates back to Windows Mobile 2003.

  2. javascript & AJAX 實做心得

    1. 可用AJAX,但desktop IE的javascript Framework有很多function不適用,因此建議還是依需求開發。

      1. 針對AJAX部份我有根據官方範例寫了一個Ajax call function for Mobile IE

        http://blackbing.net/lab/mobile/mobileAjax.js


    2. 基本的javascript幾乎都支援,getElementById, setTimeout, etc..

    3. 只有button 有onclick事件,其他如DIV、SPAN上沒有這種event。

    4. 請注意IE Mobile 沒有「onMouseOver」事件。

    5. CSS支援度差,不支援定位(position, top, left),且javascript存取css的方式也有限,必須反覆測試style的表現。

    6. On Smartphone/PocketPC 2003 innerText and innerHTML Properties are only supported on div and span elements.

      On Windows Mobile 5 innerText and innerHTML Properties are supported on all elements.


  3. 開發AJAX應用程式的注意事項:

    1. 使用者介面越簡單越好

    2. 資料傳輸量越精簡越好(JSON)

    3. DOM tree 越淺(shallow)越好

    4. 若有大量資料要隱藏,請避免使用display:none,直接採用DOM操作方式remove掉。(保持頁面資料越精簡越好)

    5. 盡可能不要讓使用者輸入data,改由select方式

    6. Adding On-Demand Script


  4. 其他:

    1. how to configure Internet Explorer Mobile to display script errors?

      To configure IE Mobile to display script error messages requires you to create a new registry entry.

      1. Open the device/emulator registry using the Remote Registry Editor or other Windows Mobile registry tool

      2. Navigate to the registry key HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main

      3. Create a new DWORD entry for the key; name the new entry ShowScriptErrors and set the value to 1

      4. Soft-reset the device/emulator

        Once you complete these steps, IE Mobile will display error messages for any script errors that occur.



    2. Enabling Cross-Domain Calls in Your Development Environment

      When working in your development environment, you can disable the security check that prevents the XMLHTTP object from making a cross-domain call. You do this by modifying the value of the appropriate registry entry using the following steps.

      1. Open the device/emulator registry using the Remote Registry Editor or other Windows Mobile registry tool

      2. Navigate to the registry key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Current Version\Internet Settings\Zones\3

      3. Change the value of the entry named 1406 to 0.

      4. Soft-reset the device/emulator

        Once you complete these steps, the XMLHTTP object can call into any domain without restriction.




  1. 參考資料:

    1. Mobile Web Development

      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/anch_mobilewebdev.asp

    2. Mobile DOM Reference Guide

      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mobilesdk5/html/mogrfdomreferenceguide.asp

    3. Mobile CSS Support

      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mobilesdk5/html/mogrfdomreferenceguide.asp?frame=true

    4. Windows Mobile Developers Wiki

      http://channel9.msdn.com/wiki/default.aspx/MobileDeveloper.HomePage