How to Get Loaded Web Page Title in Android WebView?

If you need to fetch the title of the webpage displayed in a WebView inside an Android app then there are two ways to do it. You can get the webpage title using WebChromeClient in lesser time than using WebViewClient. webview.setWebChromeClient(new WebChromeClient() { @Override public void onReceivedTitle(WebView view, String title) { setTitle(title); } }); But […]

Continue reading


Set Focus to End of Text Input using Javascript and jQuery

If the text input already has some text and you wish to set the cursor to the end of the text input then here’s how it can be done. Using JavaScript In javascript simply add a onfocus event handler in the text input. <input type=”text” onfocus=”this.value = this.value;” value=”Some text”/> Using jQuery Define a function […]

Continue reading


How to get Base64 image from an URL or Image tag

You might need to convert a png/jpeg image to a base64 encoding. The following function does that for you. function getBase64FromImageUrl(url) { var img = new Image(); img.setAttribute(‘crossOrigin’, ‘anonymous’); img.onload = function () { var canvas = document.createElement(“canvas”); canvas.width =this.width; canvas.height =this.height; var ctx = canvas.getContext(“2d”); ctx.drawImage(this, 0, 0); var dataURL = canvas.toDataURL(“image/png”); var url= […]

Continue reading