javascript - 在 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();
});
});
解决方案
推荐阅读
- python - 为什么这个说法是真的?“花费大量时间等待外部事件的任务通常是线程的良好候选者。”
- mysql - 在 VB.Net 中加密 MySQL 数据库的登录详细信息
- .htaccess - htaccess URL 掩码子文件夹到另一个域而不是重定向
- javascript - 如何在 React 中读取 Firebase 数据
- javascript - 如何在 javascript 中访问本地 XML?
- javascript - toLocaleString 添加自定义字母
- node.js - 尝试访问节点 REPL 产生错误:找不到模块 'esm'
- ms-access-2007 - 两列之间范围的 MS 访问匹配
- postgresql - Select into 仅插入 1 条记录
- ios - SwiftUI 致命错误:索引超出范围:文件 Swift/ContiguousArrayBuffer.swift