Is it possible to access an SQLite database from JavaScript?

Actually the answer is yes. Here is an example how you can do this: http://html5doctor.com/introducing-web-sql-databases/ The bad thing is that it’s with very limited support by the browsers. More information here HTML5 IndexedDB, Web SQL Database and browser wars PS: As @Christoph said Web SQL is no longer in active maintenance and the Web Applications … Read more

How do you use window.postMessage across domains?

Here is an example that works on Chrome 5.0.375.125. The page B (iframe content): <html> <head></head> <body> <script> top.postMessage(‘hello’, ‘A’); </script> </body> </html> Note the use of top.postMessage or parent.postMessage not window.postMessage here The page A: <html> <head></head> <body> <iframe src=”B”></iframe> <script> window.addEventListener( “message”, function (e) { if(e.origin !== ‘B’){ return; } alert(e.data); }, false); … Read more

How to make a simple image upload using Javascript/HTML

Here’s a simple example with no jQuery. Use URL.createObjectURL, which creates a DOMString containing a URL representing the object given in the parameter Then, you can simply set the src of the image to that url: window.addEventListener(‘load’, function() { document.querySelector(‘input[type=”file”]’).addEventListener(‘change’, function() { if (this.files && this.files[0]) { var img = document.querySelector(‘img’); img.onload = () => … Read more

Using jQuery how to get click coordinates on the target element

Are you trying to get the position of mouse pointer relative to element ( or ) simply the mouse pointer location Try this Demo : http://jsfiddle.net/AMsK9/ Edit : 1) event.pageX, event.pageY gives you the mouse position relative document ! Ref : http://api.jquery.com/event.pageX/ http://api.jquery.com/event.pageY/ 2) offset() : It gives the offset position of an element Ref … Read more

Why can’t radio buttons be “readonly”?

Radio buttons would only need to be read-only if there are other options. If you don’t have any other options, a checked radio button cannot be unchecked. If you have other options, you can prevent the user from changing the value merely by disabling the other options: <input type=”radio” name=”foo” value=”Y” checked> <input type=”radio” name=”foo” … Read more

How to load external webpage in WebView

Thanks to this post, I finally found the solution. Here is the code: import android.app.Activity; import android.os.Bundle; import android.webkit.WebResourceError; import android.webkit.WebResourceRequest; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Toast; import android.annotation.TargetApi; public class Main extends Activity { private WebView mWebview ; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mWebview = new WebView(this); mWebview.getSettings().setJavaScriptEnabled(true); // enable javascript final … Read more

make an html svg object also a clickable link

Actually, the best way to solve this is… on the <object> tag, use: pointer-events: none; Note: Users which have the Ad Blocker plugin installed get a tab-like [Block] at the upper right corner upon hovering (the same as a flash banner gets). By settings this css, that’ll go away as well. http://jsfiddle.net/energee/UL9k9/