首页 > 解决方案 > 在 safari 和 safari mobile 中加载下一个网页时显示微调器

问题描述

我试图在 safari 和 safari iOS 加载下一页时显示加载微调器。

我已经设法在 Chrome + Firefox 中实现了这一点。如果在 IE 中不起作用,我不会大惊小怪。

因此,下面的脚本在 Chrome + Firefox 中运行良好,但在 Safari 或 Safari iOS 中不起作用。

我猜“window.location.href”的行为是不同的,但是有没有办法解决这个问题?

// stop home screen webapp from exiting the webwapp into mobile safari
$("a").not('[href="#"]').each(function() {

    // bind click action
    $(this).on("click", function(e) {

        // reveal loader spinner
        $('.loading').addClass('show');

        // window href simulate click within webapp
        window.location.href = $(this).attr('href');

        // prevent default click
        e.preventDefault();

    });

});

标签: javascriptjquerysafarimobile-safari

解决方案


推荐阅读