ECMAScript is a scripting programming language, standardized by Ecma International in the ECMA-262 specification. The language is widely used on the web, and is often referred to as JavaScript or JScript, after the two primary implementations of the specification. (More info on Wikipedia)
I had read about the support by WAP browsers for ECMA script Mobile Profile or ECMA MP (ESMP) about a year back but there werent many phones out there that had these browsers. The number of models with browser support for ECMA script has shot up quiet significantly since then. This makes it more interesting. I would love to be able to prompt the user about a wrong entry in a form without making a expensive (in terms of time) connection back to the server.
I searched around for documentation and samples on ESMP but couldnt find a lot of information. The best place to start would be the Sprint Developer Site, they do have a bunch of examples and tutorials to get you started. Sprint also has quiet a few handsets out that support ESMP. Search for ECMA in the documents section on the developer site. Nokia too has a document explaining the ESMP script but I did not find it useful. OMA website has a PDF that explains the whole shabang: OMA-WAP-ESMP-V1_0-20040709-C.pdf.
Detecting phones with ECMA Script Support.
I guess the easiest way is to check the HTTP Accept header of the request for 'text/ecmascript' mime type.
------
boolean bECMASupported = false;
String accept = request.getHeader("accept");
if (accept != null && !accept.equals("") && !accept.equals("*/*")){
int index = accept.indexOf("text/ecmascript");
if(-1 != index){
bECMASupported = true;
}
}
-----
I tried out client side validation with a simple length check on a form field. I am including the XHTML code below:
---------
--------
Screenshots of how the page looks and behaves on a Samsung A900 included here.
This stuff is really cool. ESMP might not make a big dent as Javascript is already supported on a bunch of smartphones and also the new Nokia Web browser for 3rd edition handsets but on "vanilla" handsets, it could provide an edge to the WAP applications.
Which phones support this scripting and how different is the script from Java script?
ReplyDeleteI am not a Java script guru but most of the java script examples on the web worked on the phones.. Dont have a complete list of phones but most of the newer sprint phones supported ESMP.
ReplyDelete