我有一个网页,我在其中实施ADAL.JS
。
通过网页浏览网页时效果很好;然而,当我尝试在iPhone上查看它时,我使用添加到主屏幕按钮将其保存为桌面上的快捷方式时,事情变得混乱。
初始页面(index.html
)使用apple-mobile-web-app-capable
元标记正确显示;但是,当调用身份验证时,我将进入一个真正的浏览器窗口。重定向回index.html
后,我仍处于单独的浏览器窗口而不是Web App视图。
最终,我希望将此作为一个离线网站,在apple-mobile-web-app-capable
生成的视图中运行所有页面功能。关于如何实现这一点的任何其他想法都值得赞赏。
提前致谢。
答案 0 :(得分:0)
这是目前iOS webapps中存在的一个大问题。每个链接或重定向都会在新窗口中打开。
您可以使用JavaScript修改window.location.href
。
答案 1 :(得分:0)
似乎缺少一些东西......我得到urlNavigate没有定义错误...建议?
alert('Running Auth');
online = navigator.onLine;
authContext = new AuthenticationContext({
tenant: azureTenant,
clientId: azureClientId,
postLogoutRedirectUri: window.location,
//redirectUri: "https://shlpkpiapi.azurewebsites.net/kpiapp/test.html"
});
authContext.config.displayCall=function(url){
if (urlNavigate)
{
this.info('Navigate to:' + urlNavigate);
window.location.href=urlNavigate;
}
else
{
this.info('Navigate url is empty');
}
}
if (authContext.isCallback(window.location.hash)) {
authContext.handleWindowCallback();
var err = authContext.getLoginError();
if (err) {
alert('Error on callback')
}
}
else {
var user = authContext.getCachedUser();
if (user) {
//We have a user in cache and are using those credentials
console.log('Signed in as: ' + user.userName);
} else {
console.log('Not signed in.')
if (online)
{
alert('signing in');
authContext.login();
}
else
{
alert('currently offline');
}
}
}
答案 2 :(得分:0)
好的......我做了改动,错误消失了,但我不明白这是怎么解决这个问题的。当我将我的页面添加到我的iPhone主屏幕(https://xxxxx.azurewebsites.net/app/test.html),然后单击该瓷砖时,我将被带到test.html页面。在该页面上有一个auth函数,它执行使用adal.js并带我去" https://login.microsoftonline.com/xxx.onmicrosoft.com/oauth2 ..."。这显示在我的IOS Web应用程序的范围内,并列出了我的帐户和使用其他帐户选项。我点击我的帐户或选择使用其他帐户选项,我将进入另一个在Safari中打开的页面。