onblur event not working when open with Android browser - android

Everything is working when open it with Opera mobile and Firefox, but when I open it with Android browser, the function not working. How to fix it?
$(document).ready(function(){
var price = document.getElementsByClassName('harga')[0];
var tax = document.getElementsByClassName('dp_per')[0];
var taxAmount = document.getElementsByClassName('dp')[0];
tax.onblur = function() {
taxAmount.value = parseFloat(price.value) * parseFloat(tax.value) / 100;
}
})(jQuery);
Here is what I've made:
http://jsfiddle.net/mYEUP/

Related

Print a web page from a webview

I made an app that is just a webview showing a website, at a certain point in my website I have a button that prints a div via javascript, as it is it doesn't work, how can I make it possible?
my js code:
function printDiv(divName) {
var printContents = document.getElementById(divName).innerHTML;
var originalContents = document.body.innerHTML;
document.body.innerHTML = printContents;
window.print();
document.body.innerHTML = originalContents;
}

Redirect location.href doesn't work

The redirect at the end of the snippet works on Desktop machine but not on Mobile Phone (Android device)
var ajax1 = XMLHttpRequest();
var sigData = encodeURIComponent(canvas.toDataURL("image/png"));
ajax1.open("POST", './post.php');
ajax1.send(sigText.innerHTML);
$('#debug').html(canvas);
document.location.href='step2.php?xidx="+xidx+"';

Web Audio Api biquadFilter in Android needs extra configuration?

Here says the Web audio API works in Chrome for Android, and here I have tested CM Browser, Chrome and CyanogenMod default Android 5.1.1 browsers, and all pass the tests (specially the biquadNode one).
But When I open this codepen with an eq (biquadNode), I can hear the music but not the eq working.
Does biquadNode works in android? any special implementation is needed?
*Code pen required to post
var context = new AudioContext();
var mediaElement = document.getElementById('player');
var sourceNode = context.createMediaElementSource(mediaElement);
// EQ Properties
//
var gainDb = -40.0;
var bandSplit = [360,3600];
var hBand = context.createBiquadFilter();
hBand.type = "lowshelf";
hBand.frequency.value = bandSplit[0];
hBand.gain.value = gainDb;
var hInvert = context.createGain();
hInvert.gain.value = -1.0;
var mBand = context.createGain();
var lBand = context.createBiquadFilter();
lBand.type = "highshelf";
lBand.frequency.value = bandSplit[1];
lBand.gain.value = gainDb;
var lInvert = context.createGain();
lInvert.gain.value = -1.0;
sourceNode.connect(lBand);
sourceNode.connect(mBand);
sourceNode.connect(hBand);
hBand.connect(hInvert);
lBand.connect(lInvert);
hInvert.connect(mBand);
lInvert.connect(mBand);
var lGain = context.createGain();
var mGain = context.createGain();
var hGain = context.createGain();
lBand.connect(lGain);
mBand.connect(mGain);
hBand.connect(hGain);
var sum = context.createGain();
lGain.connect(sum);
mGain.connect(sum);
hGain.connect(sum);
sum.connect(context.destination);
// Input
//
function changeGain(string,type)
{
var value = parseFloat(string) / 100.0;
switch(type)
{
case 'lowGain': lGain.gain.value = value; break;
case 'midGain': mGain.gain.value = value; break;
case 'highGain': hGain.gain.value = value; break;
}
}
createMediaElementSource in Chrome on Android doesn't work in general. But if you have a recent build of Chrome (49 and later?), you can go to chrome://flags and enable the unified media pipeline option. That will make createMediaElementSource work like on desktop.

Jquery bug in Android Chrome

I have the below jquery which is working fine on desktop browsers, when I load it on an android mobile chrome and when I start typing, the second letter goes before the first letter and others follows the second letter.
Here is an image how its working...
Can anyone help me solve this out please?
$("#textbox").on('input', function(evt) {
if(this.lengh == 0) return $(this);
var input = $(this);
var start = input[0].selectionStart;
$(this).val($(this).val().replace(/[^a-zA-Z0-9 +:%=\\/-]/gi,""))
$(this).val(function (_, val) {
return val.toUpperCase();
});
input[0].selectionStart = input[0].selectionEnd = start;
});
The problem is when, in Android, the selectionStart is zero.
Test it with your phone: http://www.vixed.it/st/34947263/
$("#textbox").on('input', function(e) {
e.preventDefault();
var input = $(this);
var start = input[0].selectionStart;
var inputTextChanged = input.val().replace(/[^a-zA-Z0-9 +:%=\\/-]/gi,"").toUpperCase();
input.val(inputTextChanged);
if (start>=1) input[0].selectionEnd = start;
});

checking android os using javascript not working in uc browser

in this code, i have tried to detect android browser and then redirect to another page. Its working fine in all mobile browser except “uc browser “ what will be code I have to add in this
var ua = navigator.userAgent.toLowerCase();
var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile");
if(isAndroid)
{
if (window.confirm("hi !!"))
{
window.location.href = "www.google.com"
}
}

Categories

Resources