Found 598 Articles for Front End Scripts

How to make iOS UIWebView display a mobile website correctly?

Lakshmi Srinivas
Updated on 29-Jan-2020 06:28:55

111 Views

To display the mobile website correctly, try the following fix:mywebview.scalesPageToFit = YES; mywebview.contentMode = UIViewContentModeScaleAspectFit;You can also set the following:NSString *js = [NSString stringWithFormat:@"document.body.style.zoom = 0.8;"]; [webView stringByEvaluatingJavaScriptFromString:js];

Make HTML5 input type=“number” accepting dashes

Smita Kapse
Updated on 29-Jan-2020 06:29:36

3K+ Views

To allow HTML5 input type = ”number” to accept dashes, use a regular expression.Add the regular expression in the pattern attribute as shown below.[ 0 - 9 ] + ([ - \, ] [0 - 9] + ) ? "Add it to the code now:input type = "text" pattern = "[0-9]+([-\,][0-9]+)?" name = "my-num" title = "dashes or comma"/>The above will allow you to add dashes in number. However, above you need to use input type text for the solution to work.

Detect compatibility of the new HTML5 tag with jQuery.

Daniol Thomas
Updated on 29-Jan-2020 06:30:38

153 Views

Use the following to check the compatibility of the HTML5 tag :var $myEL = $(''); $myEL.appendTo('body'); var bgColor = $myEL.css('backgroundColor'); if (/rgb\(255\, 255\, 0\)/.test(bgColor))    return true; else    return false;

What is the most efficient way of assigning all my HTML5 video sources as trusted without having to loop over all of them

Samual Sam
Updated on 29-Jan-2020 06:28:30

74 Views

Add some config to assign trust to your videos in HTML5:app.config(function($sceDelegateProvider) {    $sceDelegateProvider.resourceUrlWhitelist([    // allowing same origin resource loads    'self',    // allowing loading from our assets domain    'http://media.w3.org/**']); });

Filter gray image, black around png in Internet Explorer 8

Vrundesha Joshi
Updated on 29-Jan-2020 06:27:59

135 Views

The filters to be applied must be formed in a single filter call. Set like this:progid : DXImageTransform.Microsoft.BasicImage(grayscale = 1)The CSS should work like the following:.demo {    background: transparent;    -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr = #00FFFFFF,endColorstr = #00FFFFFF)    progid:DXImageTransform.Microsoft.BasicImage(grayscale = 1)"; /* IE8 */    zoom: 1; }

Programmatically fire HTML5 dragstart after mousemove

Lakshmi Srinivas
Updated on 29-Jan-2020 06:25:28

155 Views

To fire dragstart after mousemove, try the following:If you are firing dragstart event, then implement the rest of the process flow as well:To solve the problem, create the user experience as follows: You need to instruct the user to click on the respective area for enabling drag When a user clicks on the area, a dialog should be visible to show that the dragging may now be used.

HTML5 audio not playing in PhoneGap App

karthikeya Boyini
Updated on 29-Jan-2020 06:27:24

207 Views

If you have set all the attributes and audio source correctly, then this can be a security issue.Add the following in your index.html.Set the AndroidManifest.xml as

How to detect the browser's format for HTML input type date

Samual Sam
Updated on 29-Jan-2020 06:26:09

386 Views

An input.the valueAsDate method returns a Date object reflecting the input's current value. The displayed value follows the same format. To make it work:new Date().toISOString().substr( 0, 10 ); new Date().toLocaleDateString(); input.valueAsDate; input.valueAsDate.toLocaleDateString(); new Date( input.valueAsDate ); new Date( input.valueAsDate ).toISOString().substr( 0, 10 );

How do I programmatically create a DragEvent for Angular app and HTML?

Lakshmi Srinivas
Updated on 29-Jan-2020 06:26:48

205 Views

To create a DragEvent, use the protractor API. The official documentation states:The browser.get method loads a page. Protractor expects Angular to be present on a page, so it will throw an error if the page it is attempting to load does not contain the Angular library. (If you need to interact with a non-Angular page, you may access the wrapped web driver instance directly with browser.driver).Use the following pattern as well:browser .actions() .dragAndDrop(myEle, {x:100,y:100}) .perform();

toDataURL throw Uncaught Security exception in HTML

Samual Sam
Updated on 29-Jan-2020 06:24:50

141 Views

To solve the Uncaught Security Exception, you need to add the crossorigin attribute: function getBase64() {    var myImg = document.getElementById("myid");    var c = document.createElement("canvas");    c.width = myImg.width;    c.height = myImg.width;    var context = c.getContext("2d");    context.drawImage(img, 0, 0);    var dataURL = c.toDataURL("image/png");    alert(dataURL.replace(/^data:image\/(png|jpg);base64,/, "")); } getBase64();

Advertisements