Codeigniter 声音完成后刷新页面

Codeigniter 声音完成后刷新页面,codeigniter,audio,embed,Codeigniter,Audio,Embed,我正在为我的网站使用codeigniter。我希望在用户单击菜单时触发声音。但是我点击页面后,页面刷新得太快了,以至于声音听不到。声音完成后,如何刷新页面 以下是html: <ul class="navigation"> <li><a href="[link1]">Menu 1</a></li> <li><a href="[link2]">Menu 2</a></li>

我正在为我的网站使用codeigniter。我希望在用户单击菜单时触发声音。但是我点击页面后,页面刷新得太快了,以至于声音听不到。声音完成后,如何刷新页面

以下是html:

<ul class="navigation">
    <li><a href="[link1]">Menu 1</a></li>
    <li><a href="[link2]">Menu 2</a></li>
    <li><a href="[link3]">Menu 3</a></li>
</ul>
<span id="dummy"></span>
下面是javascript:

$(document).ready(function(){
    $(".navigation").click(function(){
        $("#dummy").html("<embed src='<?=base_url()?>sound/testing.mp3' hidden='true' autostart='true' loop='false' />");
    });
});
$(文档).ready(函数(){
$(“.navigation”)。单击(函数(){

$(“#dummy”).html(在函数中添加一个
return false
,以避免在单击后立即刷新

$(document).ready(function(){
        $(".navigation").click(function(){
            $("#dummy").html("<embed src='<?=base_url()?>sound/testing.mp3' hidden='true' autostart='true' loop='false' />");
return false;
        });
    });
$(文档).ready(函数(){
$(“.navigation”)。单击(函数(){

$(“#dummy”).html(“我没有对音频做太多的工作,所以我不确定它的兼容性如何,但您的解决方案应该是

$(document).ready(function(){
    $(".navigation a").click(function(e){
        document.nextPage = $(this).attr('href')
        $("#dummy").html("<embed src='<?=base_url()?>sound/testing.mp3' hidden='true' autostart='true' loop='false' onended='followLink();' />");
        e.preventDefault();
    });
});

function followLink(){
   document.location.href = document.nextPage;
}
$(文档).ready(函数(){
$(“.navigation a”)。单击(函数(e){
document.nextPage=$(this.attr('href'))

$(“#dummy”).html(“我看不出页面是如何刷新的,菜单项甚至不存在links@Josh我已经编辑过了。有什么解决办法吗?网络访问者最讨厌的一件事就是不受欢迎的音频,只是说。。。
$(document).ready(function(){
   $(".navigation a").click(function(e){
        var nextPage = $(this).attr('href');
        var audioObj = $("<audio>").attr({
            "hidden":true,
            "src":"<?=base_url()?>sound/testing.mp3"
        }).bind("ended",function(){//when sound finished playing follow the link

           document.location.href = nextPage;

        }).appendTo("#dummy");

        audioObj[0].play();
        e.preventDefault(); //prevent the page from refreshing 
    });
});