我已经在Chrome+Firefox中实现了这一点。如果在IE里不起作用,我不会大惊小怪的。
所以下面的脚本在Chrome+Firefox中可以正常工作,但是在Safari或safariios中却不起作用。
// 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();
});
});