IEMobile Team Weblog

Information about Internet Explorer for Windows Mobile

AJAX on IE Mobile

Hello Everyone,

My name is Kevin Grey, I'm an SDET on the IE Mobile Team.  I wrote the following document to help inform people about how to write an AJAX enabled webapp for use on Windows Mobile devices (PocketPC and Smartphone).

~~K

Does IE Mobile Support AJAX? … YES

We've recently been getting questions regarding whether IE Mobile (aka Pocket IE, PIE, IEMO) supports AJAX.  The answer: Yes, PocketPC and Smartphone devices 2003 and later, support AJAX.

If you are wondering how you can use AJAX on your website and have it function well from your Windows Mobile browser, here are a couple things you should know:

  1. On Smartphone/PocketPC 2003
    • innerText and innerHTML Properties are only supported on div and span elements
    • Form elements are scriptable as well
  2. On Windows Mobile 5
    • innerText and innerHTML Properties are supported on all elements
    • In addition there is support for document.all and the style object

*Watch the IE Mobile Team blog for further details on our DOM support.*

An AJAX Example

For those of you who live anywhere near the poles and have yet to witness a geomagnetic storm, here is your chance.  A Geomagnetic storm is produced when solar wind particles from the sun warp the Earth's magnetosphere producing pretty lights in the night sky (also known as the Aurora Borealis, Northern Lights, etc). 

The National Oceanographic and Atmospheric Administration operates a series of Magnetographs which record changes in the Magnetosphere as a result of this solar wind.  Every 3 hours, they publish an index value between 0-9, called the K-Index.  This value represents the severity of the disturbance in the Earth's magnetic field.  Since this interaction is the fundamental cause of a geomagnetic storm, the K-Index should inform you of when you are most likely to witness one.

Our AJAX Example Goal: To write a webpage that will display the current K-Index for a given location so that people can know if there is a geomagnetic storm occurring.

The NOAA publishes the K-Index for several locations to a flat text file located here: http://www.sec.noaa.gov/ftpdir/latest/AK.txt  The file is updated every 3 hours.

Since the file is in a fixed format and therefore cannot be parsed by an XML parser, I've taken the liberty of writing a Webservice which fetches the flat file, parses it out and makes the data available as a simple WebReference:

http://iemobile.members.winisp.net/GeoMagneticData.asmx

Now that we've XML-ified our Magnetometer data, we can access this data from our webpage or any other application.

Invoking the Webservice

In order to invoke the GeoMagneticData.asmx webservice, you need to perform an HTTP POST sending certain headers and a body with an XML SOAP document.  Here is what the raw HTTP message should look like for this specific webservice:

 POST http://iemobile.members.winisp.net/GeoMagneticData.asmx HTTP/1.1
 Accept: */*
 Accept-Language: en-us
 Referer:
http://iemobile.members.winisp.net/ajax.html
 soapaction: http://tempuri.org/GetMagnetometerStation
 Content-Type: text/xml; charset=utf-8
 Accept-Encoding: gzip, deflate
 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 1.1.4322)
 Host: iemobile.members.winisp.net
 Content-Length: 469
 Proxy-Connection: Keep-Alive
 Pragma: no-cache
 
 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
 xmlns:xsd="
http://www.w3.org/2001/XMLSchema"
 xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body>
  <GetMagnetometerStation xmlns="
http://tempuri.org/">
  <email>nobody@nobody.com</email>
  <password>blank</password>
  <station_name>Boulder</station_name>
  </GetMagnetometerStation>
 </soap:Body>
 </soap:Envelope>

As a response to this message, we will receive:

 HTTP/1.1 200 OK
 Proxy-Connection: Keep-Alive
 Connection: Keep-Alive
 Content-Length: 648
 Date: Tue, 15 Nov 2005 19:25:49 GMT
 Content-Type: text/xml; charset=utf-8
 Server: Microsoft-IIS/6.0
 X-Powered-By: ASP.NET
 MicrosoftOfficeWebServer: 5.0_Pub
 X-AspNet-Version: 1.1.4322
 Cache-Control: private, max-age=0
 
 <?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="
http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
 xmlns:xsd="
http://www.w3.org/2001/XMLSchema">
 <soap:Body>
  <GetMagnetometerStationResponse xmlns="
http://tempuri.org/">
  <GetMagnetometerStationResult>
   <StationName>Boulder</StationName>
   <Latitude>49</Latitude>
   <Longitude>42</Longitude>
   <CurrentKIndex>1</CurrentKIndex>
   <CurrentAIndex>1</CurrentAIndex>
  </GetMagnetometerStationResult>
  </GetMagnetometerStationResponse>
 </soap:Body>
 </soap:Envelope>

Now on to the Javascript which will invoke the webservice and parse the response.  I've broken the request and response portions of the webservice call into two separate functions:

 InvokeWebservice()
 ParseResponse()

The InvokeWebservice() function will perform the HTTP POST.  It then sets a callback function which will asynchronously invoke ParseResponse() when the HTTP response is received:

function InvokeWebservice(url)
{
    // Tell the user that we're invoking the webservice
    result.innerHTML = "Requesting Data..."; 
    //Construct an XMLHTTP Object to handle our HTTP Request
    var xmlHttpReq = false;
    try
    {
        xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");
    }   
    catch (err)
    {
        try
        {
            xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (err2)
        {
        }
    }
    // Specify HTTP Method as POST so that we can upload large amounts of text
    xmlHttpReq.open('POST', url, true);
    // Set the content type to text/xml, otherwise the webservice will not
    // consider it a valid XML document

    xmlHttpReq.setRequestHeader('Content-Type', 'text/xml; charset=utf-8');
    // Set the SOAPAction header, otherwise the webservice won't be invoked.
    xmlHttpReq.setRequestHeader('SOAPAction', 'http://tempuri.org/GetMagnetometerStation');
    // Set a callback to be invoked when the ReadyState changes on the XMLHTTP object.
    // If the ReadyState value == 4, then the request is completed.
    // See for more info:
http://tinyurl.com/858me
    xmlHttpReq.onreadystatechange = function() 
    {
        if (xmlHttpReq.readyState == 4) 
        {
            ParseResponse(xmlHttpReq);
        }
    }
    // Insert the station name within our XML document 
    // and Send the HTTP Request
    // The XML has been snipped for presentation

    xmlHttpReq.send("<?xml version=\"1.0\" … <station_name>" + 
    document.forms['f1'].stationname.value +
    "</station_name></GetMagnetometerStation></soap:Body></soap:Envelope>");
}

The ParseResponse() function receives the XMLHTTP object instance and fetches the values for the StationName, Latitude, Longitude and CurrentKIndex.  It then performs some simple logic on the lat/long values and generates a description.  Then it sets the innerHTML property of a div tag with our pretty-printed text:

function ParseResponse(xmlHttpReq)
{
    // Fetch the values from our response XML
    var station_name = xmlHttpReq.responseXML.getElementsByTagName('StationName')[0].text;
    var lat = xmlHttpReq.responseXML.getElementsByTagName('Latitude')[0].text;
    var lng     = xmlHttpReq.responseXML.getElementsByTagName('Longitude')[0].text;   
    var kindex = xmlHttpReq.responseXML.getElementsByTagName('CurrentKIndex')[0].text;
    var descr = "";
    // Pretty Print the Latitude and Longitude values
    
<SNIPPED>View source for this</SNIPPED>
    
// Generate the description for our data     
    if (kindex < 0)
    {
        descr = "No Data Available for this Location";
        kindex = "Unknown";
    }
    if (kindex < 4)   
    {
        descr = "Low or No Geomagnetic Activity";
    }
    else if (kindex < 7)
    {
        descr = "Moderate Geomagnetic Activity";   
    }
    else if (kindex < 9)
    {
        descr = "High Geomagnetic Activity -- Auroras Visible in Mid Latitudes";
    }
    else if (kindex <= 10)   
    {
        descr = "Extreme Geomagnetic Activity -- Auroras Visible in Mid and Lower Latitudes";
    }
    // Set the text data as the innerHTML propery of a div tag identified as 'result'
    result.innerHTML = "Station: " + station_name + "<br>\n";
    result.innerHTML += "Location (geomagnetic dipole): " + lat + " " + lng + "<br>\n";
    result.innerHTML += "K-Index: " + kindex + "<br>\n";
    result.innerHTML += descr + "<br>\n";
}

With these two functions defined, we can now create some simple HTML to allow us to query for the current K-Index for a given location:

<p>Station: 
    <SELECT NAME="stationname">
        <OPTION VALUE="Planetary Index">Overall Planetary Index</OPTION>
        <OPTION VALUE="Boulder">Boulder, CO</OPTION>
        <OPTION VALUE="Chambon-la-foret">Chambon-la-foret, France</OPTION>
        <OPTION VALUE="College">College, AK</OPTION>
        <OPTION VALUE="Fredericksburg">Fredericksburg, VA</OPTION>
        <OPTION VALUE="Kergulen Island">Kergulen Island</OPTION>
        <OPTION VALUE="Learmonth">Learmonth</OPTION>
        <OPTION VALUE="Wingst">Wingst</OPTION>
    </SELECT> 
    <input value="Get Index" type="button" onclick='InvokeWebservice("
http://iemobile.members.winisp.net/GeoMagneticData.asmx");'>
</p>
<div id="result"/>

For a working demo of this page, please visit http://iemobile.members.winisp.net/ajax.html
Here are some screenshots of the page in action, as seen from a Smartphone 2003 device emulator:

 

         
Published Tuesday, November 15, 2005 11:29 PM by iemoblog

Comments

 

songyoungbin said:

as i type the url(http://virtualearth.msn.com) on wm5 emulator , i've got a error message.

A problem has occurred with gwes.exe

why?
November 22, 2005 5:02 PM
 

Giovanni said:

It works fine!!
January 13, 2006 3:18 AM
 

Karen E. said:

The example works fine for me on Pocket PC 2003, but when I use the same client-side code from within some of my own HTML pages, I get xmlHttpReq.status = 900 and the call doesn't reach the server.  When I initiate a 2nd AJAX call, it always works, with status = 200.  What does a 900 status mean?

Thanks
February 6, 2006 2:06 PM
 

Zandoná Mobile® said:

I have been asked about AJAX development support for Internet Explorer Mobile (running on Windows Mobile-based...
May 3, 2006 10:29 AM
 

Vinod Seraphin said:

What about document.getElementById support for PocketIE?  Does any existing or upcoming version support it?
May 11, 2006 5:54 PM
 

DEP said:

NICE!!!
What about ASP.NET AJAX-Enabled controls?
It seems that those kind of controls doesn't work well in PIE.
May 21, 2006 5:51 AM
 

Lancelotti said:

I have a Windows CE 2003 on Audiovox pocket pc and the example not run. I try other examples and not run to.
May 25, 2006 6:23 PM
 

CoolCode.CN » 用 PHPRPC 开发 Windows Mobile IE 上的 Ajax 程序 said:

May 28, 2006 3:48 AM
 

Christopher said:

This seems great, but one problem... I see no way to set an interval in Javascript for Windows Moblie IE?  I have Windows Mobile 5.

setInterval() does not work at all?
June 12, 2006 10:38 AM
 

iemoblog said:

Christopher:

You can work around the lack of support for setInterval by using the setTimeout function.  When it executes your script on timeout, just call setTimeout again to queue it up again.

HTH,
Randy
June 12, 2006 11:40 AM
 

iemoblog said:

Vinod:

document.getElementById is supported in the Messaging and Security Feature Pack for Windows Mobile 5.0 and will be supported moving forward...

Randy
June 12, 2006 11:41 AM
 

dirk said:

Where can I get the Messaging and Security Feature Pack for Windows Mobile 5.0?
June 28, 2006 4:14 AM
 

mIDO said:

simply... WOW!!!!!
July 3, 2006 2:32 PM
 

drodrig said:

And what about ATLAS? Will work for IE Mobile 5.0?

July 6, 2006 8:16 AM
 

Randy Ramig said:

At this time, Atlas will not work for IE Mobile.  We are working with the Atlas team on this, so stay tuned!
Randy
July 10, 2006 12:25 PM
 

Tomi said:

Hi there,

Glad to know IEMO supports most IE desktop behaviors.  What's the JScript version for IEMO???


Cheers,
Tomi
July 31, 2006 10:58 PM
 

iemoblog said:

Tomi:

Windows Mobile 5.0 has JScript 5.6.  Check out this deck for more information: http://blogs.msdn.com/iemobile/attachment/570375.ashx

Randy
August 1, 2006 11:38 AM
 

Rodrigo said:

Hello everybody! Sorry to miss the point, but I would really like to know this: does IEMO/PIE accept microsoft filters/transitions and the style.zoom?
August 2, 2006 10:13 AM
 

iemoblog said:

Rodrigo -- no support for filters/transitions, nor for zoom.  Out of curiosity, what would you use them for?
--Randy
August 3, 2006 12:13 PM
 

Rodrigo said:

Hi Randy! I'm researching and proposing a multi-device interface design and would like to know if there is ANY similar zoom function available on ANY handheld for a prototype development. Do you know?
August 3, 2006 1:54 PM
 

Bertrand Barrie said:

When I try to queue a request every seconds (using setTimeout) to refresh a html table of my document, PIE seem to grow of 10Ko by seconds !

After a short period it freeze ... how can I solve this problem ?
August 8, 2006 6:13 AM
 

iemoblog said:

Bertrand,
Can you post your code so we can have a look?
Randy
August 8, 2006 12:05 PM
 

Bertrand Barrie said:

Here is the script as use for test purpose on pocket IE (Windows Mobile 2005)

In a first time I use the setTimeout method directly inside end of callback to requeue the same request. I though referencing the request inside the callback was the origin of the leak/memory inflation due to circular" references between DOM objects and (real) jscript objects, so I put the set timeout inside the callserver

var REFRESH_PERIOD_MILLIS = 1000;
var requestResults = null;


/// Queue a request
function XmlHttpRequest(XmlHttp, anUrl, aCallBack)
{
XmlHttp.open("GET", anUrl, true);
XmlHttp.onreadystatechange = aCallBack;
XmlHttp.send(null);
}

/// Create a new XMLHttpRequest object to talk to the web server
function createXmlHttpRequest()
{
var XmlHttp = null;
try {
XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e1) {
try {
XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e2) {
XmlHttp = null;
}
}
if(!XmlHttp && typeof XMLHttpRequest != 'undefined') {
XmlHttp = new XMLHttpRequest();
}
return XmlHttp;
}

function callServer() {

requestResults = createXmlHttpRequest();
requestResults.open('GET', '../cgi-bin/GetLastEventTime.cgi?target=MvFlowMonitoring', true);
requestResults.onreadystatechange = function() { callback(requestResults); }
requestResults.send(null);

window.setTimeout(function () { callServer(); }, REFRESH_PERIOD_MILLIS)
}

function callback(requestResults) {

if(requestResults.readyState==4) {
if(requestResults.status == 200) {
document.all.content.innerHTML += requestResults.responseText+'<br/>'
}
requestResults = null;
}
}
August 8, 2006 12:50 PM
 

iemoblog said:

Bertrand, I don't see anything obvious here.  Could you specify more about the growth you are seeing?  How much does it grow, and how long does it take?  How are you measuring it?
The only thing I see is that you are concatenating the HTML onto the content element, so I guess it depends on how big responseText is each time.
Thanks,
Randy
August 10, 2006 6:03 PM
 

Bertrand Barrie said:

The line  document.all.content.innerHTML += requestResults.responseText+'<br/>'  is just here for test purpose.

The server send us a list of lines like value1|value2|value3|...|valueN where each lines is separated from each others by a '\n'.

Here I just try to isolate the cause of THE growING and suppress all other code parts.

With the real page, I split the answer; foreach lines I can extract an url (an image) a date and a description, I dynamically insert image by writting a new <img> tag in the content div (htmlContent) like this:

htmlContent.innerHTML += '<p>'+items[1]+' [<a href="'+items[0]+'">VIEW</a>]'+'<br/><img src="'+items[0]+'" width="'+width+'" height="'+Math.ceil(3/4*width)+' alt="'+items[0]+'" /></p>';

Note I only keep the 5 newer lines (the 5 latest procuded images) in the page to avoid having a still increasing list of pictures.

When I look at Start Menu > Settings > System > Memory, I can see in the <program> column In use increasing by 0,02 - 0,03 MB / second and the <Free> column decreasing by the same value. Once we reach few free memory, a dialog box appears and says a script takes a lot of ressources and make the system slow ...

Thanks for your help
BB
August 11, 2006 4:05 AM
 

iemoblog said:

Betrand:
I think the best course of action here is for you to publish the page on a server somewhere so I can hit it and repro.
Thanks,
Randy
August 22, 2006 10:02 PM
 

Webizado said:

I have rather a tangential question? If I have to write a browser using WebBrowser controls with maximum flexibility (I want to provide my own html, images, scripts, etc.. and I want to get notified about every user action) what is the best way to do it? I am looking for references to the set of specific classes and itnerfaces i should use. any help is appreciated.
August 24, 2006 2:52 PM
 

iemoblog said:

That's not tangential at all.  For the degree of control that you are seeking, I recommend hosting the HTML Control.  Check out:

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

Randy
August 25, 2006 12:09 PM
 

najeeb said:

Thanks for the link. I was already looking into that. Things that I am not clear is that:

Let's say, I want to provide my own video stream to an html control: will i have to create a local stream and modify the URL in html to point to the local stream as well? I see that I can provide javascript and css to the control - that is great.

What i really care about is where the data comes from. So, if the control can call back my application for all the http requests, that's all I want. Is there any other interface that would let me do that? Basically for every http request it makes, it should call back my app, and the app will provide http response back.

Thanks guys for your help.
August 28, 2006 2:30 PM
 

iemoblog said:

The HTML Control will fire notifications for external resources that it needs from the network.  You can handle these notifications by returning non-zero from the notification.  See:

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

-Randy
August 29, 2006 11:54 AM
 

piyush.hari said:

onclick JS handler on a span element works fine with IE or Mozilla Firfoz but not with IE mobile. any suggestions if its going to be up any sooner ?
September 7, 2006 3:05 PM
 

Beebop said:

Hi Guys,

I have a few issues when trying to make the httprequest for some reason on my pocket PC. It seems that the script bombs out when creating the MSXML2.XMLHTTP object.

http_request = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) { // IE
try {
http_request = new ActiveXObject("MSXML2.XMLHTTP");
} catch (e) {
try {
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
alert(e);
}
}
}
if (!http_request) {
alert('Cannot create XMLHTTP instance');
return false;
}



                   http_request.open('POST', url, true);

here is a snippet of the code i am using but as i said for some reason the device cant seem to create the MSXML2 object. It does however create the Microsoft.XMLHTTP object but then it gives an "object error" when running  "http_request.open('POST', url, true);" Any ideas because i am stumped.

Thanx

September 12, 2006 9:47 AM
 

iemoblog said:

<DIV> and <SPAN> are on our short-term list.

Although technically almost every layout element can have an onclick handler, we actually don't implement them on non-focusable elements - those which we don't give you a highlighted focus rectangle around.  Part of that is inherent to how we do link to link navigation, which usability shows is preferable over trying to do an ugly, cumbersome "cursor" which a user would then drive around the screen on a Smartphone.  

So, we've been evaluating some usability studies here about the best way to give these no-focus elements onclick handlers.  Getting a solution for those that want to put an onclick() handler in DIV and SPAN tags is high on our list, although we're still going to stick with the recommendation that you not do that sort of thing, and use alternative layout designs, instead.

FWIW, I have a couple of guys looking into div.onclick() right now...

-Cameron
September 12, 2006 6:14 PM
 

PieMagician said:

Hi folks, My question is regarding the behavior of JavaScript Image() objects in PIE when using Ajax and JavaScript. When the page loads I have a function that creates an array of Image objects and preloads a number of images that my scripts are going to swap around on the page I'm displaying. It all works great while I'm just testing the scripts on their own by calling them directly through on page links. However, once I make an Ajax call and get the result, the contents of my stored Image objects are cleared. My array still contains valid Image objects for each element, but each Image object's 'src' field has been cleared. I've already worked around the issue, but was curious if this was intended behavior. A second odd behavior I've noticed is that if I use JavaScript to change the '.src' field of an image contained within a
block in the page to another image URL, the whole div block is blanked out. I can only get it to redraw correctly by setting the display attribute of the div to 'none' and then back to '' again. The result is an annoying flicker, but I can deal with that for now. What would I be trying to do with this you might ask? By using JavaScript and calling upon the dark powers that reside deep within PIE I have emulated a scrollable 'div' block for helping make better use of the limited screen real estate when displaying a list of items. Since PIE doesn't seem to support scrollable (overflow:scroll;) divs quite yet... Thanks, Matt Currier
September 22, 2006 4:14 PM
 

Ruslan Trifonov's blog said:

Having my Vista gadget from my previous posts( 1 , 2 ), I decided to see if I&#39;ll be able to monitor

October 28, 2006 6:33 PM
 

e-portfolio » Blog Archive » Is ajax mogelijk in de verschillende mobile webbrowsers? said:

January 10, 2007 8:00 AM
 

WebChicanery » Mobile Internet said:

January 16, 2007 10:55 PM
 

Christopher Steen said:

.NET Micro Framework SDK [Via: The Moth ] An Overview of Cryptographic Systems and Encrypting Database...

February 14, 2007 11:54 PM
 

EyeOfTheStorm said:

Hi,

I need help. I build a working ajax enabled website. It works well on normal IE, but I have strange things in Pocket IE.

In my HTML code I call   <body onload="somechecks()"> to start a refresh loop.

function somechecks() {

   var loginView    = document.all["loginName"];

   var newBondView  = document.all["newbondidentifier"];

   var sheetDefault = document.all["sheets_default"];

   if (loginView) {

    loginView.focus();

   }

   if (newBondView) {

    newBondView.focus();

   }

   if (sheetDefault) {

    generateSubList();

       doRun();

   }

}

function doRun() {

   var url = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + window.location.pathname + "?cmd=ajax_advice";

invokeAJAXRequest(url);

setTimeout(function () { doRun(); },5000);

}

function invokeAJAXRequest(url) {

 var request = false;

 if (window.XMLHttpRequest) {

request = new XMLHttpRequest();

 } else if (window.ActiveXObject) {

request = new ActiveXObject("Msxml2.XMLHTTP");

 } else {

   request = new ActiveXObject("Microsoft.XMLHTTP");

 }

 if (request) {

   request.open("GET", url, true);

   alert(url);

   request.onreadystatechange = function()

   {

       if (request.readyState == 4)

       {

           processReturn(request.responseText);

       }

   }

   request.send("");

 } else alert("Error");      

}

Everything looks fine so far and I don'T get any error. If I place an alert box somewhere, I can see, that my loop will be called every 5 secounds. Also the HTTP Request will be send send every round. But on the server side, nothing happens. The request will not fired out in not one single round.

The strange thing is, I am calling the same thing with an onChange event on the same page. When this event is fired, the route is the same .... but this time ... the request will be catched on server side.

function adviceServer(obj) {

   var url = window.location.protocol + "//" + window.location.hostname + ":" + window.location.port + window.location.pathname + '?cmd=ajax&subcmd=' + obj.name + '&data=' + obj.value;

invokeAJAXRequest(url);

}

This is the HTML item, that calls the action <input onFocus="haveFocus(this)" onChange="adviceServer(this)" class="low" type="text" name="$item.getBondId()_MBPX" value=""/>

Any ideas?

February 19, 2007 10:39 AM
 

EyeOfTheStorm said:

Hi,

to my comment from yesterday ....

I found the problem ... it has nothing to do with IE Mobile. It is the "_" in some urls. Maybe IEMobile does not autoparse urls to HTTP UPL encoding with a illegal character replacement.

February 20, 2007 2:48 AM
 

fritze said:

Like the Post of Bertrand Barrie  on August 10, 2006 12:05 PM, we have the same Problem with a memory leak (pocket IE, Windows Mobile 2005 )

"When  you look at Start Menu > Settings > System > Memory, you can see in the <program> column In use increasing by 0,02 - 0,03 MB / second and the <Free> column decreasing by the same value. Once we reach few free memory, a dialog box appears and says a script takes a lot of ressources and make the system slow ... "

The Url is http://www.additiv.net/memoryleak/

have anybody an idea or a solution?

March 11, 2007 7:02 AM
 

prc said:

innerHTML and innerText appear to have oddly different behavior on WM5.0 (smartphone).

When I navigate away from a page and then return (using back button), the first page can read and write the innerText of a <div> (or <span>), but can only read the innerHTML of the same <div>.  An attempt to write the innerHTML throws an error.  This is doubly odd because it also clears the previous content of the <div>.

If I navigate two pages away and then hit the back button twice, the original page appears just as when I first loaded it and I can read/write both innerHTML and innerText.

Sample code is below.  To see problem, click on the "test" button several times.  The counters for both innerText and innerHTML will increment.

Then click on the link to google, and then the back button.  Clicking "test" now will increment the innerText counter, clear the text of the innerHTML counter and produce an error.  

I would have expected that innerHTML and innerText would behave the same way.  Since they don't, is there a way I can detect in advance whether rewriting innerHTML will fail?

Sample page:

<html>

<body>

<script language="javascript">

var ctr = 1;

function update() {

document.getElementById('Text').innerText= ctr;

document.getElementById('HTML').innerHTML= ctr++;

}

</script>

innerText: <span id="Text">0</span><br>

innerHTML: <span id="HTML">0</span><br>

<input type=button value="test" onclick='update();'>

<br>

<a href="http://www.google.com">google.com</a><br>

</body>

</html>

March 17, 2007 7:22 PM
 

iemoblog said:

prc, Thanks for reporting this. I was able to reproduce this on the WM 5 version of IE Mobile, but it works as expected on WM 6. It was fixed somewhere along the line, but I don't have a bug reference number for you.

-Steve

March 30, 2007 6:12 PM
 

iemoblog said:

fritze,

We are investigating this memory leak issue. I have been able to reproduce what you describe, and it's in our bug tracking database.

-Steve

March 30, 2007 8:04 PM
 

AbuAnas - ???????????? » Ajax ?????? ?????????????? ???????????? said:

April 5, 2007 2:21 AM
 

maccoy said:

Can you provide the following:

IE mobile Complaint:

HTML Version : 3.2 or 4.1 or some sub set?

JScript : 5.5 or 5.6 ?

CSS : 1.0 or 2.0 ?

DOM  : 3.02 or some thing else?

or where can i find thise detail in Microsoft site?

April 20, 2007 6:46 AM
 

iemoblog said:

Maccoy,

HTML Version 4.01

JScript 5.6 (ECMA-script 262 edition 3)

CSS Mobile Profile, with most of CSS 1 supported and some of CSS 2 supported

DOM Level 0 with most of level 1 and some of level 2

Documentation can be found on MSDN: http://msdn2.microsoft.com/en-us/library/ms879933.aspx

-Steve

April 20, 2007 1:08 PM
 

Sabri Arslan said:

i have tried too many way to execue setTimeout but it is only executing properly in body tag. i have tried in head tag and nothing happens.

<html>

<head>

<script type='text/javascript'>

var xt;

var ff=false;

var ie=true;

function AjaxRun(url,sonuc,func,met)

{

sonuc.innerHTML = "Veri Bekleniyor Lütfen Bekleyiniz...";

var xmlHttpReq = false;

try

{

xmlHttpReq = new ActiveXObject("Msxml2.XMLHTTP");

       ie=true;

}  

catch (err)

{

try

{

xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");

           ie=true;

}

catch (err2)

{

xmlHttpReq = new XMLHttpRequest();

           ie=false;

           ff=true;

           if (xmlHttpReq.overrideMimeType) {

               xmlHttpReq.overrideMimeType('text/xml');

}

}

}

   // Diger

   if ( !xmlHttpReq && window.createRequest ) {

    try{

     xmlHttpReq = window.createRequest();

    }catch(e) {

     xmlHttpReq = false;

    }

   }

   xmlHttpReq.open(met, url, true);

xmlHttpReq.setRequestHeader('Content-Type', 'text/xml; charset=windows-1254');

xmlHttpReq.onreadystatechange = function()

{

if (xmlHttpReq.readyState == 4)

{

eval('func(xmlHttpReq);');

}

}

xmlHttpReq.send("");

sonuc.innerHTML = "";

}

function metin_oku(xmlObj,field){

var sonuc;

if(ie){

 try{

  sonuc = xmlObj.responseXML.getElementsByTagName(field)[0].text;

 }catch(err){

  alert('isteğiniz işlenirken bir hata oluştu\n'+field+err);

  sonuc='';

 }

}else if(ff){

 try{

  sonuc = xmlObj.responseXML.getElementsByTagName(field).item(0).firstChild.data;

 }catch(err){

  alert('isteğiniz işlenirken bir hata oluştu\n'+field+'\n'+err);

  sonuc='';

 }

}else{

 sonuc='';

}

return sonuc;

}

function getiText(obj){

if(document.all){

 return obj.innerText;

}else{

 return obj.textContent;

}

}

function setiText(obj,val){

if(document.all){

 obj.innerText=val;

}else{

 obj.textContent=val;

}

}

function findObj(theObj, theDoc)

{

 var p, i, foundObj;

 if(!theDoc) theDoc = document;

 if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)

 {

   theDoc = parent.frames[theObj.substring(p+1)].document;

   theObj = theObj.substring(0,p);

 }

 if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];

 for (i=0; !foundObj && i < theDoc.forms.length; i++)

   foundObj = theDoc.forms[i][theObj];

 for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)

   foundObj = findObj(theObj,theDoc.layers[i].document);

 if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);

 return foundObj;

}

function myfunc(){

 var reqstr='query.php?query=stocklist';

 AjaxRun(reqstr,findObj('message'),myfuncx,'GET');

}

function myfuncx(xmlHttpReq){

 var x=metin_oku(xmlHttpReq,'msg');

 findObj('message').innerHTML=x;

 clearTimeout(xt);

 xt=setTimeout("myfunc()",3000);

}

</script>

</head>

<body>

<script type="text/javascript">

xt=setTimeout("myfunc()",3000);

</script>

<div id='message'></div>

</body>

</html>

May 8, 2007 9:58 AM
 

tomoro said:

Steve,

On March 30th you confirmed reproducing the memory leak issue. Is there a bug number, and fix or workaround for this problem? We need to go live with a customer in 2 weeks and this is a showstopper bug for us. Has anyone else solved this problem?

-- Thomas.

June 7, 2007 5:53 AM
 

iemoblog said:

tomoro,

There is no way to fix browsers already on devices. The best we can do right now is make fixes to the next version of the browser that will ship in future mobile devices.

As for the specific memory leak issue, all I can suggest is that you don't make continuous frequent use of XMLHttpRequest on a single page. Navigating to a new page frees the memory.

June 7, 2007 10:16 AM
 

Eloan WebLog » Blog Archive » Communications Innovations said:

July 27, 2007 4:59 PM
 

Eloan WebLog » Blog Archive » Communications Innovations said:

July 27, 2007 4:59 PM
 

Keni Barwick - The Mobile Guy said:

Today a fellow Conchango technology team member Pryank Rohilla (start blogging mate!) let me know about

October 3, 2007 12:36 PM
 

simonjo said:

I try to update an <img src="..."> element using below script which works with regular IE on PC but not with Mobile IE (WM5) on iPAQ... what can be the problem? the intention is to report the status of a light and show either an image light0.gif if the light is turned off, or light1.gif if the light is turned on.

I see the AJAX request arrive at the server, it's correctly processed and results are returned, but in function ajaxRsp(..)  it seems that 'if (document.getElementsByTagName)' returns FALSE and is never executed, although this is returning TRUE on regular IE !?!?!? also tried this with getElementsByName but works neither.

!!! HELP !!!

mvg, Jo

Calling HTML code looks like this:

<a href="/nojs.html" title="Toggle" onClick="ajaxReq('omd.0.out1.toggle', 'omd0out1', '/icontrol/img/light', '.gif');return false;">

     <img border="0" name="omd0out1" src="/icontrol/img/light0.gif" title="Toggle">

Javascripts look like this:

function ajaxReq(strCommand, strSink, strPrefix, strSuffix) {

 var objReq = null;

 try {

   objReq = new ActiveXObject("Msxml2.XMLHTTP");

   } // try

 catch (err) {

   objReq = null;

   return false;

   } // catch

 objReq.open("GET", "icontrol.dll?terse&ccmd=" + strCommand + "&dummy=" + Math.random(), false);

 objReq.onreadystatechange = function(){

   if (objReq.readyState == 4 && objReq.status == 200) {

     if (objReq.responseText){

       ajaxRsp(objReq.responseText, strSink, strPrefix, strSuffix);

       }

     }

   }

 objReq.send();

 return true;

 } // ajaxReq

/* implement response on document */

function ajaxRsp(strRsp, strSink, strPrefix, strSuffix) {

 if (document.getElementsByTagName) {

   var colImg=document.getElementsByTagName("img");

   for (i = 0; i < colImg.length; i++) {

     if (colImg[i].name == strSink) {

       colImg[i].src = strPrefix + strRsp + strSuffix;

       } // if

     } // for

   } // if

 } // ajaxRsp

October 23, 2007 11:39 AM
 

iemoblog said:

simonjo:

You're right - unfortunately, getElementsByTagName is not supported in IE Mobile on WM5.  We have added support in WM6.

In the meantime, you should be able to use the document.images collection to get your hands on the data that you need.  You can find out more about what is supported in WM5 here:

http://msdn2.microsoft.com/en-us/library/aa455291.aspx

Hope that helps!

-Charles

October 23, 2007 12:35 PM
 

simonjo said:

Charles,

Thanks a lot, I rewrote the script to use the document.images collection and it truly works... just great.

Thanks again for the help, regards, Jo

October 23, 2007 1:34 PM
 

simonjo said:

Another problem encountered on Mobile IE5, following tag calls the JavaScript ajaxDim(..) correctly on Mozilla and IExplorer but not on Mobile IE5...

Removing the href="" attribute disables clicking on the area, so it must be present.

Any idea how to solve this one?

<map name="dim.00.out0">

 <area shape="rect" href="" coords="71, 0,77,15" title="100%"

       onclick="ajaxDim('ccmd=!dim.0.out0.set.255.1&wait=500&ccmd=dim.0.level0', 'dim0out0', '/icontrol/img/dimh', '.gif');return false;">

 </map>

October 25, 2007 5:48 AM
 

iemoblog said:

simonjo:

Yes, the <area> tag does not support scriptable events.  You can workaround this by using:

<area shape="rect" href="javascript:ajaxDim('ccmd=!dim.0.out0.set.255.1&wait=500&ccmd=dim.0.level0', 'dim0out0', '/icontrol/img/dimh', '.gif')" coords="71, 0,77,15" title="100%">

-Charles

October 25, 2007 2:13 PM
 

simonjo said:

Charles,

Your proposed fix works, but in the meantime I had changed the implementation to reduce the amount of static data (i.e. the map definition), as such the onclick was moved to an IMG object.

Here I have the same problem that the javascript is not called in Mobile IE5, do you have a fix for this as well? if not I will use the map solution.

    <img border="0" id="dim.0.out1" src="/icontrol/img/dimh<#phc dim.0.level1+31/32#>.gif"

         onclick="ajaxDim2(this, event, 'dim.0.out1', '/icontrol/img/dimh', '.gif');return false;">

Thanks, Jo

October 25, 2007 4:12 PM
 

iemoblog said:

Hi Jo:

You should be able to fix that by wrapping the <img> with an <a> and putting the onclick on the <a>.  i.e.

<a href="#" onclick="ajaxDim();return false"><img border="0" src="image.jpg" /></a>

-Charles

October 26, 2007 3:29 PM
 

owigg said:

I have a problem with link to link navigation using the directional keypad on a device.

Is there a Javascript event which would tell me the user has highlighted a link with the directional keypad. Like a focus for the <a> tag?

December 7, 2007 7:34 AM
 

iemoblog said:

owigg:

Have you tried the onfocus event?  

http://msdn2.microsoft.com/en-us/library/bb159687.aspx

-Charles

December 7, 2007 1:26 PM
 

Alcides Fonseca - Mobile AJAX said:

January 18, 2008 3:04 PM
 

Does Windows Mobile 6.1 Provide "Full Desktop Browsing?" | mobile web & digital lifestyle news said:

April 14, 2008 7:42 PM
 

Life Log&raquo; Blog Archive &raquo; links for 2008-04-29 said:

April 29, 2008 3:29 AM
Anonymous comments are disabled

© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker