Found 598 Articles for Front End Scripts

Open a file browser with default directory in JavaScript and HTML?

V Jyothi
Updated on 30-Jan-2020 06:10:44

1K+ Views

If you want to open a file browser in JavaScript and then want to set a default directory same as the file folder, then we cannot do it since windows do not allow you to do so,so it is not possible. For example:C: :\AmitThis is mainly due to security risk involved to let web code to set any value on the machine.We can never be assured that even directory exists or not.

Client side validation with HTML and without JavaScript

Krantik Chavan
Updated on 29-Jan-2020 10:53:36

289 Views

To display HTML5 client-side validation error bubbles, use the required attribute.You do not need to have javascript for client side validations like empty text box would never be submitted because HTML5 introduced a new attribute called required which would be used as follows and would insist to have a value:                    Enter email :          Try to submit using Submit button                    

Upload directly to Amazon S3 using Plupload HTML5 runtime

Lakshmi Srinivas
Updated on 30-Jul-2019 22:30:22

157 Views

Amazon S3 now supports cross-origin resource sharing so HTML5 uploads are now possible.Before it was not possible. Plupload can be directly uploaded to HTML5 by cross-origin resource sharing (CORS).With the help of CORS (Cross-origin resource sharing), rich client-side web applications can be created.It selectively allows cross-origin access to S3 resources with the help of which we can access Amazon.

Trick to store credentials in local storage

karthikeya Boyini
Updated on 30-Jul-2019 22:30:22

466 Views

Local Storage is designed for storage that spans multiple windows and lasts beyond the current session. In particular, Web applications may wish to store megabytes of user data, such as entire user-authored documents or a user's mailbox, on the client side for performance reasons.For storing credentials in local storage, on successful login, generate a completely random string unrelated to user credentials. You need to store this in the database. Do not forget to add an expiry date. Pass that string to the JavaScript to be stored in local storage.As long as the local storage credential matches the database and the ... Read More

Create a text inside circles in HTML5 Canvas

Nishtha Thakur
Updated on 29-Jan-2020 10:52:50

1K+ Views

To create a text inside circles in canvas, use the:context.beginPath();The following is the canvas:$("#demo").on("click", "#canvas1", function(event) {    var canvas = document.getElementById('canvas1');    if (canvas.getContext) {       var context = canvas.getContext("2d");       var w = 25;       var x = event.pageX;       var y = Math.floor(event.pageY-$(this).offset().top);       context.beginPath();       context.fillStyle = "blue";       context.arc(x, y, w/2, 0, 2 * Math.PI, false);       context.fill();       context = canvas.getContext("2d");       context.font = '9pt';       context.fillStyle = 'white';       context.textAlign = 'center';       context.fillText('amit', x, y+4);    } });HTML    

How to completely fill web page with HTML canvas?

V Jyothi
Updated on 29-Jan-2020 10:51:22

365 Views

To make canvas fill the whole page, you need to be 100% in width and height of the page.* {    margin: 0;    padding: 0; } body, html {    height:100%; } #canvas {    position:absolute;    height:100%; width:100%; }

How to allow the restricted resources from another domain in web browser with HTML5

Smita Kapse
Updated on 29-Jan-2020 10:50:07

307 Views

Cross-origin resource sharing (CORS) is a mechanism to allows the restricted resources from another domain in a web browserFor suppose, if you click on HTML5- video player in html5 demo sections. it will ask camera permission. if user allows the permission then only it will open the camera or else it doesn't open the camera for web applicationsHere Chrome, Firefox, Opera and Safari all use the XMLHttprequest2 object and Internet Explorer uses the similar XDomainRequest object, object.function createCORSRequest(method, url) {    var xhr = new XMLHttpRequest();    if ("withCredentials" in xhr) {       // Check if the XMLHttpRequest ... Read More

Validate the size of input=file in HTML5?

Govinda Sai
Updated on 29-Jan-2020 10:49:35

2K+ Views

You can try to run the following code to validate the size of input type file:                                                                                                   $(function(){                $('form').submit(function(){                   var val = true;                       $('input[type=file][data-max-size]').each(function(){                   if(typeof this.files[0] !== 'undefined'){                      var max = parseInt($(this).attr('max-size'),10),                      mySize = this.files[0].size;                      val = max > mySize;                      return val;                   }                });                return val;             });          });          

Top frameworks for HTML5 based mobile development

Lakshmi Srinivas
Updated on 30-Jul-2019 22:30:22

230 Views

The following are some of the top frameworks for HTML5 based mobile development:1. Kendo UIUse Kendo UI to develop an invaluable cross-platform mobile application.2. BootstrapBootstrap supports HTML, CSS, and JS that allows developing mobile apps with responsive layouts.3. Ionic Ionic is open source framework used for developing mobile applications. It provides tools and services for building Mobile UI with native look and feel. The ionic framework needs a native wrapper to be able to run on mobile devices.4. Sencha TouchSencha Touch is a mobile application framework to develop user interface for mobile apps using HTML5, CSS3, and JavaScript. It assists the ... Read More

HTML5 preload attribute

Anvi Jain
Updated on 29-Jan-2020 10:22:10

150 Views

To prevent HTML5 video from loading before playing, use preload attribute. You can try to run the following code:                                        Your browser does not support the video tag.          

Advertisements