Speech Synthesis API isn't working in mobile browsers - javascript

I'm trying to use the SpeechSynthesis API for my website, but it turns out that the same code that works on a desktop browser, doesn't work on a mobile browser.
<!DOCTYPE html>
<html>
<head>
<title>prueba</title>
</head>
<body>
<button onclick="play()">Play</button>
<script>
function play() {
if ('speechSynthesis' in window) {
console.log("The API is installed");
var ssu = new SpeechSynthesisUtterance("hello world");
window.speechSynthesis.speak(ssu);
}
}
</script>
</body>
</html>
I have tested it on a Huawei P10 with Chrome, iPhone X with Safari, and a Moto G5 with Chrome. None of these work. Does it work on your phones? Do you know how to fix it? Thank you.
UPDATE:
After deleting the history and cleaning cache, it works on Android devices. But it still doesn't work on iPhones (I've tested it on Iphone X and Iphone 6, before and after deleting the history and cache).

Related

Kinvey not working on iPhone and iPad

I'm using Kinvey's backend services accessing by their Javascript API. Initialisation of Kinvey works fine in any PC browser (Safari, FF, Chrome) and also on FF mobile and Chrome mobile. I got this error on iPhone's Safari and iPad's Safari only, console output:
jQuery.Deferred exception: Can't find variable: Kinvey
https://.html:22:15
l#https://code.jquery.com/jquery-3.3.1.min.js:2:29380
https://code.jquery.com/jquery-3.3.1.min.js:2:29678
Here's the code showing the error:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>My App</title>
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
<script src="https://da189i1jfloii.cloudfront.net/js/kinvey-html5-sdk-3.11.1.min.js"></script>
<script src="https://matthewcv.github.io/mobiledebug.js"></script>
</head>
<script>
$(document).ready(function() {
console.log("before");
// Init Kinvey
Kinvey.init({
appKey: '<yourAppKey>',
appSecret: '<yourAppSecret>'
});
console.log("after");
});
</script>
<body>
<div>
Show something
</div>
</body>
</html>
I'm working with the latest iOS as well as the latest Javascript packages.
I wrote several times into Kinvey's forum but nobody seems to care of. So I try it here in hope someone knows the solution.
Based on remotesynth's comment I was sure that something screwed up my iPhone. After a complete reset of the device I could make it working too.

Simple JavaScript works in Chrome only (need Internet Explorer)

I am facing an issue:
I need to do html meta refresh (because I do windows gadget, this is only thing what works in Internet Viewer (not Internet Explorer), there is no location.href or anything similar (it always opens in new windows instead of currect gadget windows).
Therefore onhly HTML meta refresh works to link a page.
So I was tweaking the JS to have a variable into the meta refresh, and it works only in chrome, but it doesnt work in ordinary Internet Explorer... once I make it work in IE, it shall work in gadget windows too.
How to adapt this code to work on Internet Explorer (if you have a chance to try it out in Internet Viewer, would be even better).
<html>
<head>
</head>
<body>
<meta http-equiv="refresh" content="5;url=http://www.google.com">
<script>
var username = "jzaloudek";
var url = "http://localhost/excel/test.php?name=" + username;
var time = 5;
document.getElementsByTagName("META")[0].httpEquiv = "refresh";
document.getElementsByTagName("META")[0].content = time + ";url=" + url;
</script>
<p>Loading...</p>
</body>
</html>

IPad not supporting target ="_self"

I am trying to use Skype for business URIs to open on an IPad from safari browser. But whenever I click on link its not showing popup for opening Skype for business app. It's working fine for chrome and other browsers on IPad, but not for safari. Here is the code for it:
<!DOCTYPE html>
<html>
<head>
<script>
function myfunction() {
window.open("sip:","_self")
}
</script>
</head>
<body>
IM for desktop
</body>
</html>

Play sound on Safari (iOS) and Chrome (Android) using JavaScript

I want to be able to play sound on HTML page using JavaScript when some event happens.
Basically I want to get data from server using AJAX and then if it is something specific, then play sound.
It works great on PC browsers, but I have issues making it work on Safari (iOS) and Chrome (Android). I read that to play sound on Chrome (I guess Safari also), this needs to be triggered by some user event (gesture, click, etc.). So here is my SIMPLIFIED code:
<!DOCTYPE HTML>
<head>
<meta http-equiv="refresh" content="7" />
</head>
<body>
<button onclick="playSound()" id="button">Click me</button>
<script>
window.setInterval(function(){
parent.document.getElementById('button').click();
}, 5000);
function playSound() {
var audio = new Audio('http://www.soundjay.com/button/beep-01a.wav');
audio.play();
}
</script>
</body>
</html>
I thought this workaround will work (trigger click event using JS), but still no sound.
One additional thing is that I want to AJAX code every few seconds and even when phone is BLOCKED. I found this solution (and applied my changes from previous try):
background.html:
<!DOCTYPE HTML>
<head>
<meta http-equiv="refresh" content="3" />
</head>
<body>
<script>
parent.run_function_from_core_page();
</script>
</body>
</html>
In index.html:
<iframe src="background.html" style="display:none;"></iframe>
But again, works great on PC, but no sound on either Chrome mobile and Safari mobile.
Any suggestions? Is that even possible?

Javascript not executed on Firefox, working on Chrome & Safari

starting this morning I'm having difficulties executing Javascript code on Firefox. This simple code example:
<html>
<head>
<script type='text/javascript'>
alert('HEAD!');
</script>
</head>
<body>
<script type='text/javascript'>
document.write('<p>BODY</p>');
</script>
</body>
works as expected on
Safari - Version 7.0.2 (9537.74.9)
Chrome - Version 33.0.1750.149
but NOT on Firefox - Version 27.0.1. I'm getting a blank page here, page source looks good.
Firebug says:
No Javascript on this page
I've already
checked the about:config => javascript.enabled true
disabled all extensions and restarted Firefox
restarted Apache/MAMP PRO (2.1.4) - doesn’t even work for me via intErnet, so this should be not related to MAMP (http://shoco.biz/test.html)
restarted the computer (Mac OS X 10.9.2)
Any ideas? Thanks in advance...
Try opening firefox in safe mode help -> Restart with Add ons disabled then reset everything

Categories