我们目前正在开发在 Salesforce1 应用程序中运行的 Visualforce 页面之一。我需要从此页面导航到 iOS native 应用程序之一。
早些时候我使用的是 - window.top.location = '<appurl>';
此命令在 iOS 12 及其早期版本中按预期工作。当我在一台具有 iOS 13.0 版本的 iOS 设备上运行同一页面时,它不会将我导航到 iOS native 应用程序。
为了解决此导航问题,我实现了以下解决方案 -
1. window.location = '<appurl>';
2. document.location = '<appurl>';
3. window.location.href = '<appurl>';
4. location.replace("<appurl>");
5. window.top.location = '<appurl>';
6. location.href = '<appurl>';
7. window.location.assign("<appurl>");
以下是我的代码片段 -
var versionNumberiOS = parseFloat(getiOSversion());
if(versionNumberiOS != null && versionNumberiOS < 13.0) {
window.top.location = '<url>'; //this works for ios < 13
} else {
window.location = '<url>'; //Here I need to implement solution
}
function getiOSversion() {
if (/iP(hone|od|ad)/.test(navigator.platform)) {
var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
}
}
请帮助我使用 javascript/jquery 解决 iOS 13.0 版本上的导航问题。
最佳答案
您可以尝试使用setTimeout
setTimeout(function(){
document.location.href = "other_page.html";
},500);
关于javascript - 如何使用 Javascript 或 JQuery 从 Salesforce1 应用程序导航到 iOS 13 中的其他 native 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57690737/