web application development with j2me - javascript

The main reason I'd like to use j2me is that one of its main advantages is that it can access the phone's resources through its various APIs. However, due to newer phones having web browsers like Safari, Opera, and Windows IE, it would be advantageous to build a web application so a user wouldn't have to download some software onto their phone. Is there a way I could build a web application that can also acquire resource information about the phone? Or maybe have j2me converted to Javascript (if that's even possible)?

You can make a link that would send an SMS, but other than that, there's no cross-platform api for accessing phone internals from browser, as far as I know.
So, if you've got to access phone's resources, you'll have to write a real app.

The webkit engine on recent Series60 phones has been given access to at least some phone resources.
Nokai calls it Web Runtime or WRT.
http://www.forum.nokia.com/Resources_and_Information/Documentation/

Related

Can the Web NFC api be used in Progressive Web Applications?

I need to implement NFC (near field communication) in a PWA (progressive webapplication)
Every browser I have tested (Chrome MacOSX, Safari MacOSX, Safari iOS, Chrome for android) does not include the navigator.nfc object in navigator and it seems impossible to make use of this API: https://w3c.github.io/web-nfc/#conformance.
Is it possible to use NFC in any way in a PWA? Or do I have to develop a native application for this functionality?
Web NFC API is available only in Chrome for Android and that too when a flag is enabled(try about:flags) enabled.
Unless you are targeting your app for some internal corporate app where you can set the flag in all targeted users browser, I would recommend go with native code or wrapper(cordova or have a native app send in the details via web sockets)
This API is not making much progress since 2015 and so you can expect no magic to happen anytime soon. So don't rely on this API if you are targeting this for a critical app, especially when you cant control the end users browser settings.
From chrome 81 you can use NFC
https://blog.chromium.org/2020/02/chrome-81-near-field-communications.html

Is it possible redirect user to launch scanner application?

I'm writing an application to show the uploaded documents using python3-django-1.8.1. We also want to allow user to scan a document.
As you know that, there is a print dialog in javascript.
window.print()
Is there any support in the browser to scan a document?
Is it possible to launch a scanner application on clients machine, using javascript/python?
like:
"Windows Fax and Scan" on Windows machines
"Simple Scan" on linux, etc. OR
Whatever the default scanner application on respective os of the client.
Any third party python application/js plugin allow to scan a document?
I am not too familiar with a image scanning feature, but I had faced a similar issue with a barcode scanner.
You cannot actually expect something similar to printing, as printing is a browser-enabled feature whereas scanning is something a typical browser does not do.
Moreover, JS has no capability of accessing peripherals directly. What would happen if this page would be browsed by a mobile? (A scan from the camera would be fantastic but never heard of anything like it).
Having said that, there is a scanner.js SDK:
scanner.js enables any web page to acquire images from scanners using JavaScript in most desktop browsers like IE, Chrome, Firefox and more. In most cases, software install is not required and the user can enjoy a great scanning experience.
Also there is a Twain SDK:
Dynamic Web TWAIN is a TWAIN-based scanning SDK software specifically designed for web applications.
These are supposingly dealing with your issue but I haven't used them. Scanner.js demo is not even working now on my Ubuntu machine. My guess is that they are not entirely JS-based anyway (com objects and stuff).
Other things to do is to have a small Firefox plugin developed if your case is specific (such as Intranet) so to control the users' browsers.
Last, but not least, another option would be to develop and provide a small desktop app to handle scanning and uploading.
If there is any other recommendation I would love to see it.

Browser Awareness of Bluetooth Beacons / iBeacons

Is there a way to make a browser aware of iBeacon devices in its proximity?
Similar to the way HTML5 Geolocation is working...
If not would this be something that can be achieved with a browser plug-in that can provide the detail to be consumed by javascript?
Unfortunately, no. No web browsers have implemented any bridges between beacon detection and JavaScript.
I don't think a plugin approach is possible on mobile browsers (either iOS or Android), because neither browser supports asynchronous communication between external apps and JavaScript in Mobile Safari / Mobile Chrome. The best you could do is have a custom app that responds to a beacon, then launches a web page in the browser. But I realize that isn't what you are asking for.
If you want to build a native app with JavaScript, you can use Cordova (aka PhoneGap) and use plugins that provide beacon support. My company has one for our ProximityKit beacon framework:
https://github.com/RadiusNetworks/proximitykit-plugin-cordova
There is also a Cordova plugin that has basic beacon support here:
https://github.com/petermetz/cordova-plugin-ibeacon
This looks promising (2016), Google Chrome developers site showing a desktop browser feature as a work in progress.
https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web?hl=en
Even though the Web Bluetooth API specification is not finalized yet,
the Chrome Team is actively looking for enthusiastic developers (I
mean you) to try out this work-in-progress API and give feedback on
the spec and feedback on the implementation.
Web Bluetooth API is currently available to be enabled experimentally
on your origin in Origin Trials, or locally on your machine using an
experimental flag. The implementation is partially complete and
currently available on Chrome OS, Chrome for Android M, Linux, and
Mac.
Go to chrome://flags/#enable-web-bluetooth, enable the highlighted
flag, restart Chrome and you should be able to scan for and connect to
nearby Bluetooth devices, read/write Bluetooth characteristics,
receive GATT Notifications and know when a Bluetooth device gets
disconnected.
https://github.com/WebBluetoothCG/web-bluetooth/blob/gh-pages/implementation-status.md
There's a W3C specification for this Web Bluetooth, but there's no support yet: http://caniuse.com/#search=bluetooth.
If you decide to write a Phonegap plugin implementing this spec will be a good starting point.

Get a tablets(iPad or Droid) mac address?

Synopsis: I am developing a HTML5 web app that will allow tablets(iPad or Droid) to login to a server and perform various functions. The client would like a way to check the devices mac address when logging in. From what I have read, most solutions use activex objects that will not work for webkit browsers.
Question: Does anyone know a solution that would hook into a HTML5 web app seamlessly(Idealy update a hidden form element with the value upon logging in)?
Thanks!
I don't think there's going to be a straightforward way to do this. The web server won't be exposed to a client's MAC address unless they're on the same physical segment...you'll only see the MAC from the most recent router hop in general.
If anything exists, it's going to be a browser plugin (show-stopper on iOS). And it would probably need more than the default permissions available (I don't suspect you can enumerate network interfaces in Java, for example, without asking for elevated permissions).
If you're looking for HTML/JS only then I don't think that this is possible. It won't be exposed.
The problem is that the packets you recieve back will only contain the MAC address of the node on the last hop.
This may be possible via a plugin, but then this limits you on iOS, and possibly also Android as you'd need to provide them a way of getting the plugin first (unless you used a plugin that was installed by default).
Edit: Not that I support an app for every little thing, but it shows that easy to press app buttons sometimes tend to do better than web apps (regardless of being able to make browser shortcuts to home screens). If it is suitable, you could consider loading this within a web view on the target device from within an app, from which you can then of course access MAC addresses and whatever else you may need.
MobiThinking: Mobile applications: native v Web apps – what are the pros and cons?
Forbes: Mobile Web App vs. Native App? It's Complicated

What is the best way for a website to check if a user has installed a client app?

Let's say I've got a website that works better if a client has installed and logged into a desktop application. I'd like to be able to do 2 things:
Alter the website if they haven't installed the app (to make it easy for them to find a link to the installer)
If they've installed the app on a couple of machines, determine which machine they are browsing from
I'd like something that works on Windows and OSX, on any of the major browsers. Linux is a bonus.
A few thoughts:
Websites can detect if you've got Flash installed. How does that work and could it be used for both of my goals?
Could I just let the client serve HTTP on localhost and do some javascript requests to fetch a local ID? I know google desktop search did something like this at one point. Is this a standard practice?
Thanks!
You can register a protocol from your desktop application (see this). This can be used, for example, to open your desktop application with arbitrary data from the website. You could then have your desktop app send a HTTP request to your webserver, telling it what machine you are on.
You can have a browser plugin (activex for IE or Netscape plugin for the rest of the browsers) that can communicate with the application. When the webpage is loaded, it can try to instantiate the plugin and if it succeeded, it can use it as a proxy to the application. If it fails, then either the app is not installed or the plugin was explictly disabled by the user. Either way, your website should degrade its functionality accordingly.
Update: Forgot to answer your questions:
Flash does it exactly this way. Flash is a browser plugin that is created by the web pages.
You can have a machine ID generated at the application/plugin install time and your plugin can pass that machine ID to the webpage when it is created.
On the topic of using local webserver:
I would stay away from having a local webserver, mainly because of security considerations. It takes quite a lot of work to make sure your local webserver is locked down sufficiently and there are no XSS vulnerabilities that other malicious websites can exploit to make it do stuff on their behalf.
Plus, having a webserver means that either it has to run as a system-wide process, or if it runs as the user, you can have the website interact with only one user's instance of the application, even though multiple users can be logged on and running it at the same time.
Google Desktop Search suffered from both the XSS security vulnerability (though they fixed it) and the limitation of only one user being able to use it on a machine (I don't know if they fixed this one yet, though chances are they did).
Websites can detect if you've got Flash installed.
Actually, I believe a browser can detect if you have the Flash plugin for the browser installed, and webpages can offer "installed" and "uninstalled" option that the browser can choose.
Otherwise, you are asking for a means, by putting some code in a webpage, of being able to analyze a user's home computer, and report what it learned to you website.
Can you say Major Security Hole?
If you can pick a development environment for the desktop app, then check out AIR from Adobe. It lets you develop desktop applications using either html/javascript, Flash, or Flex.
It has API calls you can use from a browser based flash app to see if the desktop based AIR app is installed, what version, etc. You can even launch it and pass parameters from the web app to the desktop app.
http://www.rogue-development.com/blog2/2008/03/interacting-with-an-air-app-from-a-browser-based-app/
Websites can detect if you've got Flash installed. How does that work and could it be used for both of my goals?
it's quite a bit simple, your browser tries to render some additional files, with some specific formats such as flash .swf and I the browser doesn't find installation, then will be start downloading, or you will get the option to download that program.
Flash also uses AC_RunActiveContent.js please take a look at this js, people usually put this on their webpages
if (AC_FL_RunContent == 0) {
alert("This page requires AC_RunActiveContent.js.");
} else {
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave cabs/flash swflash.cab#version=8,0,0,0','width','981','height','635','id','build5','align','middle','src','build5','quality','high','bgcolor','#ffffff','name','build5','allowscriptaccess','sameDomain','allowfullscreen','false','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','build5' ); //end AC code
}

Categories