We use 站点管理员我们的应用程序中的身份验证。
如果应用程序用户尝试导航到特定页面https://ourapp.com/myapp/#/pending/requests
在我们的应用程序中通过直接 URL 或通过书签 URL,SiteMinder
将重定向到login page
通过 302 重定向类似于http://ourapp.com/login?redirect=https%3A%2F%2Fourapp.com%2Fmyapp%2F#/pending/requests
要求用户在 a 中输入凭据登录表单。身份验证成功后,用户应该被重定向到我们的应用程序并登陆所请求的页面(/pending/requests
).
它工作得非常好Chrome
and Firefox
。当谈到 IE 时,它会登陆https://ourapp.com/myapp/#/home
(默认登陆页面)而不是https://ourapp.com/myapp/#/pending/requests
.
我尝试过中提供的各种解决方案google search results
在我们的应用程序代码中,例如
- 去除
<base>
tag in index.html
- 在页面顶部添加以下代码行
// setting location back
window.location = window.location;
// setting location hash back
window.location.hash = window.location.hash;
Though 本次问答完全有道理,
我还想preserve the URL hash fragment in IE even it's 3xx redirect
为了我的要求...!?
回答我自己的问题
我发现认证成功后,SiteMinder
是在做302 redirection
通过使用用户请求的应用程序页面登录表单隐藏变量value
(它存储用户请求的 URL/myapp/
- without hash fragment
因为它不会被发送到服务器),名称类似于redirect
。下面的表格示例
Since redirect
隐变量value仅包含/myapp/
如果没有哈希片段并且它是 302 重定向,则哈希片段甚至在进入我们的应用程序之前就会被 IE 自动删除,并且无论我们在应用程序代码中尝试的解决方案都不起作用。
IE 正在重定向到/myapp/
仅,它登陆我们应用程序的默认主页https://ourapp.com/myapp/#/home
.
浪费了几乎一天的时间来弄清楚这种行为。
解决办法是:
已经改变了登录表单隐藏变量(redirect
) value保存哈希片段
追加window.location.hash
以及现有的价值。类似于下面的代码
$(function () {
var $redirect = $('input[name="redirect"]');
$redirect.val($redirect.val() + window.location.hash);
});
此次变更后,redirect
隐藏变量将用户请求的 URL 值存储为/myapp/#/pending/requests
and SiteMinder
正在将其重定向到/myapp/#/pending/requests
in IE.
上述解决方案在所有三个浏览器中都运行良好Chrome, Firefox and IE
.
感谢@AlexFord详细解释并提供解决方案对于这个问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)