Found 601 Articles for Front End Scripts

HTML5 & JavaScript: resolution or size of

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

460 Views

When the device is taking very large photos and we want to make such setting to take smaller photos from the mobile phone, then we can use two W3C ways of taking pictures.This can be done either through HTML or through JavaScript.HTML Media CaptureFor this, HTML uses capture and accept=”image/* ” on input tag .This will specify intend.However, through this way, we cannot specify the sizeMedia capture streamsIt allows fully programmatic access to the camera so that user can implement own capture dialogue for videos and still images.It also specifies constraints related to width, height, frame rate, facing rate, facing ... Read More

Remove a FileList item from a multiple “input:file” in HTML5

V Jyothi
Updated on 30-Jan-2020 06:58:16

1K+ Views

When there is a situation where we need to remove items from DOM’s through JavaScript, we cannot do so directly from FileList object. We need to assign the following to an array:$('input:file#upload')[1].filesAfter that remove items from this array using splice or method of our choice and use that array.Another way is to upload files with the help of HTML file uploader and then delete corresponding objects by using JavaScript.

Uniquely identify files before uploading with the HTML5 file API

Nitya Raut
Updated on 30-Jul-2019 22:30:22

124 Views

While making a fileuploader using HTML5 file API, we want to be sure that no duplicate files are uploaded based on actual data. Calculating a hash with MD5 is not an efficient method as all that happen on the client side and is time-consuming. There is actually no shortcut for this. If we need to identify duplicate files with no confusion then we have to first read the content of each file and then compare it.Another way is to find MD5 hash for given subset of file blocks using predefined invariant window.

HTML5 using src using raw binary data

Govinda Sai
Updated on 30-Jan-2020 06:52:52

746 Views

If an audio file is stored in database and then we want to use this file as a blob or binary in an application where audio source is according to session then binary data is returned through ${sessionScope.user.music}. To load the audio file in an audio tag, data:audio/mp3;base64 works well.As for the image, image tag is used as follows:

HTML5 getCurrentPosition almost always failing in PhoneGap on iOS

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

50 Views

PhoneGap has geolocation which works well for iOS, however, in IOS6, getCurrentPosition fires a failure callback. After failure, the getcurrentPosition calls success or failure callbacks. To let PhoneGap works on IOS6, we need to set PhoneGap.plist to No.If it is set to yes then ios6 have memory problems. However, Apache Cardova can be used for this purpose for iOS. There are many bugs in an older version of Cardova, so it should be updated to Cardovanew version.

HTML5 drag and drop will not drop

Vrundesha Joshi
Updated on 30-Jan-2020 06:52:23

383 Views

It is because there is no dragover event handler; however, default event handler of dragover event is used. After that, no drop event is triggered.e.preventdefault is needed for dragover event before drop event.If you want to allow a drop, then default handler is prevented for canceling the event. This can be done either by returning false from an attribute-defined event listener or by calling events event.prevent default method. False is returned when the division has dragover as property.The default is prevented.

Splitting and uploading extremely large files to Amazon S3

Sravani S
Updated on 30-Jul-2019 22:30:22

425 Views

For storing extremely large files on Amazon S3, the configured virtual machine can be used which would be 10+ GB in size.In HTML5 file API, very large files are divided into small bits on the client. The server has the responsibility to join files together and move the complete file to S3. There is no cost of sending the files between EC2 and S3, but for this, we need to maintain 2 apps to send large files. In Amazon multipart upload if chunk upload fails, it can be restarted. A 5GB data can be divided into 1024 separate parts and upload each one ... Read More

Circle Collision Detection HTML5 Canvas

karthikeya Boyini
Updated on 30-Jan-2020 06:14:28

319 Views

If we want to check whether circles are colliding with each other or not, one way is by getting the distance between two centers of circles and subtracting the radius of each circle from that distanceWe also check if the distance is greater than 1. If we want to check it for 20 circles, then we need to calculate exact differences in distances. x/y positions of centers vs the radii.bs(x2 - x1) > (r2 + r1) abs(y2 - y1) > (r2 + r1)The circles cannot collide if the distance in X or Y between circle centers is greater than the ... Read More

How to detect point on canvas after canvas rotation in HTML5

V Jyothi
Updated on 30-Jan-2020 06:15:29

200 Views

Whenever we work with canvas and want the canvas to be rotated, we need to translate point to draw point as per its rotation.A transform class can be made to detect point on the canvas after canvas rotationvar t = new Transform(); console.log(t.transformPoint(5,6)); //Transform point will be [5,6] t.rotate(1); // Same transformations can be applied that we did to the canvas console.log(t.transformPoint(5,6)); // Transformed point will be [-2.347, 7.449]

Draw part of an image inside HTML5 canvas

Rishi Rathor
Updated on 30-Jan-2020 06:14:59

371 Views

If you want to draw part of an image inside canvas, the image onload function only fires once when the image first loads into the browser. Let us see the example:$(document).ready(function () {    var cw1 = 200;    var ch1 = 300;    var ctx1 = $("#myCanvas")[0].getContext("3d");    var myImg1 = new Image();    myImg1.src = "http://oi62.tinypic.com/148yf7.jpg";    var Fpst = 60;    var Player1Tank = {       x: cw1 / 2,       w: 85,       h: 85,       Pos: 3,       draw: function () {       ... Read More

Advertisements