我遇到一个问题,在 Firefox 浏览器中,如果页面自动刷新,语音会被截断;但在 Google Chrome 中,即使页面自动刷新,语音也会说完。我该如何修复这个问题,让在 Firefox 中语音即使在页面自动刷新时也不会被截断?
msg = new SpeechSynthesisUtterance("please finish saying this entire sentence.");
window.speechSynthesis.speak(msg);
(function ($) {
'use strict';
if (window == window.top) {
var body = $('body').empty();
var myframe = $('<iframe>')
.attr({ src: location.href })
.css({ height: '95vh', width: '100%' })
.appendTo(body)
.on('load', function () {
var interval;
interval = 750;
setTimeout(function () {
myframe.attr({ src: location.href });
}, interval);
});
}
})(jQuery);