By now, you’ve already heard about it: someone who religiously reads Google’s compacted CSS files found a reference to an icon called mini_webdrive.gif in one of them, and now everyone – including me – needs to post on their blog about how this hypothetical Google webdrive will enable us to do such incredibly amazing things as… store files.
I don’t know. Am I the only one finding it difficult to get excited about this?
But here’s something I could get mildly excited about: an API which would allow any site to store files on your web drive the same way apps on your computer can store files on your local hard drive, as scientifically illustrated by the following image:

This way your favorite services could write copies of your data to the webdrive location you provided. Not only would this allow you to seamlessly use files between any desktop and web applications, it would also mean that when another successful and popular web startup went out of business because their cunning business plan didn’t include making money, you wouldn’t need to worry because you’d know that you have a copy of your data safely stored on servers of a company which only occasionaly loses their user’s emails.
And finally, some sort-of related reading which talks about completely self-hosting clones of popular web apps, as opposed to only having separate storage for data, described above:
Tags: An excuse for drawing rainbows, Cloud, Google, Storage
Here’s another Android WebView tutorial for those of you who are looking for a way to get the source code of a page loaded in a WebView instance.
This example is a bit more complicated than previous ones, so let me explain it step by step:
- First, a class called MyJavaScriptInterface is defined. It implements a single public method showHTML() which displays a dialog with the HTML it receives as a parameter.
- Then, an instance of this class is registered as a JavaScript interface called HTMLOUT. The showHTML() method can now be accessed from JavaScript like this: window.HTMLOUT.showHTML(‘…’)
- In order to call showHTML() when the page finishes loading, a WebViewClient instance which overrides onPageFinished() is added to the WebView. When the page finises loading, this method will inject a piece of JavaScript code into the page, using the method I described in an earlier post.
- Finally, a web page is loaded.
final Context myApp = this;
/* An instance of this class will be registered as a JavaScript interface */
class MyJavaScriptInterface
{
@SuppressWarnings("unused")
public void showHTML(String html)
{
new AlertDialog.Builder(myApp)
.setTitle("HTML")
.setMessage(html)
.setPositiveButton(android.R.string.ok, null)
.setCancelable(false)
.create()
.show();
}
}
final WebView browser = (WebView)findViewById(R.id.browser);
/* JavaScript must be enabled if you want it to work, obviously */
browser.getSettings().setJavaScriptEnabled(true);
/* Register a new JavaScript interface called HTMLOUT */
browser.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT");
/* WebViewClient must be set BEFORE calling loadUrl! */
browser.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url)
{
/* This call inject JavaScript into the page which just finished loading. */
browser.loadUrl("javascript:window.HTMLOUT.showHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
}
});
/* load a web page */
browser.loadUrl("http://lexandera.com/files/jsexamples/gethtml.html");
WARNING
Unfortunately, this approach suffers from a major security hole: if your JavaScript can call showHTML(), then so can JavaScript from every other page that might get loaded into the WebView. Use with care.
Tags: Android, JavaScript, WebView, WebViewClient
Years of big promises and hyperbole. Multiple definitions for most important terms. Revolutionary “semantic” applications that turn out to be nothing more than yet another implementation of social bookmarking. NLP people hijacking the term “semantic web” and acting like they are too good to be even remotely associated with anything as primitive as linked data. Performing text matching and calling it “artificial intelligence”. These are just some aspects of the horribly confusing state that what we call “The Semantic Web” is in right now; and has been for years.
Confused? Yes, many of us are. So here are two excellent articles that might clear things up a bit for you:
Tags: Misconceptions, Semantic Web, Web 3.0
The second release of Mosembro is now available for download.
If you already have Mosembro installed, uninstall it first by running: adb uninstall com.lexandera.mosembro
The new version can then be installed by executing the following command: adb install mosembro-r2.apk
Major changes from r1:
- Multiple actions can now be attached to a single link.
- Microformat parsing logic was separated from action logic. Each microformat is parsed only once now and parsed data is then passed to one or more actions registered to handle that microformat.
- Two new “travel to…” actions were added for addresses. One uses London Journey Planner and the other one uses Bay Area Trip Planner
- alert(), confirm() and prompt() JavaScript functions now work.
Here is an example screenshot of multiple actions on one link:

Multiple actions attached to one link
More screenshots and/or a video should be available in a couple of days.
As promised earlier, here is an example of how to add support for alert() function to a WebView in your Android application:
final WebView browser = (WebView)findViewById(R.id.browser);
/* JavaScript must be enabled if you want it to work, obviously */
browser.getSettings().setJavaScriptEnabled(true);
final Context myApp = this;
/* WebChromeClient must be set BEFORE calling loadUrl! */
browser.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onJsAlert(WebView view, String url, String message, final android.webkit.JsResult result)
{
new AlertDialog.Builder(myApp)
.setTitle("javaScript dialog")
.setMessage(message)
.setPositiveButton(android.R.string.ok,
new AlertDialog.OnClickListener()
{
public void onClick(DialogInterface dialog, int which)
{
result.confirm();
}
})
.setCancelable(false)
.create()
.show();
return true;
};
});
/* load a web page which uses the alert() function */
browser.loadUrl("http://lexandera.com/files/jsexamples/alert.html");
Code for adding support for confirm() and prompt() is almost identical and can be found in Mosembro’s source code.
Tags: Android, JavaScript, WebChromeClient, WebView
My blog stats are telling me that many visitors are arriving here looking for examples on how to implement WebChromeClient on Android. I don’t (yet) have a nice article about how to do it, but you can have a look at how I implemented WebChromeClient in Mosembro, if you came here for that reason. Just use your browser’s search functionality and look for “new WebChromeClient”.
Tags: Android, browser, example, WebChromeClient, WebView