小编exs*_*ide的帖子

当页面自动刷新时,语音在Firefox中被截断,但在Google Chrome中不被截断

我有一个问题,在Firefox中,如果页面自动刷新,语音会被截断,但是在谷歌浏览器中,即使页面是自动刷新的,语音也会结束。我如何解决这个问题,以便即使页面自动刷新也不会在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);
Run Code Online (Sandbox Code Playgroud)

javascript refresh speech-synthesis webspeech-api

11
推荐指数
1
解决办法
389
查看次数