Keeping URL Fragments when redirecting in Internet Explorer

雨燕双飞 提交于 2019-12-06 07:59:10

问题


I'm currently facing a challenge with URL fragments in a single page application. When logging in the user will be redirected through Struts to a url containing a URL fragment / Hash / Anchor - part.

<action name="LoginAction" class="de.my.stuff.LoginAction">
    <interceptor-ref name="myStack" />
    <result name="error">
         <param name="location">/jsp/login.jsp</param>
         <param name="anchor">${hash}</param>
    </result>
    <result name="success" type="redirectAction">
        <param name="actionName">LoginSuccessAction</param>
        <param name="anchor">${hash}</param>                                
    </result>
</action>

As you can see the URL fragment is appended through struts with the anchor parameter. I tested this with IE11, Chrome and Firefox.

Chrome and Firefox will keep the information from the redirect URL. IE11 won't. Since i can't be the first one facing this problem my question is:

Is there a good workaround for IE10 and IE11? I've seen some solutions using cookies but our application must be able to run with cookies disabled.

I read a blog where Eric Law wrote about that this problem existed in pre IE10 versions:

http://blogs.msdn.com/b/ieinternals/archive/2011/05/17/url-fragments-and-redirects-anchor-hash-missing.aspx

and he also states that IE10 and IE11 should be keeping the fragment now but i can't get this to work. Is there anything i am missing?

A sample URL:

http://localhost:1234/myapp#id_123abgheji324

来源:https://stackoverflow.com/questions/22168031/keeping-url-fragments-when-redirecting-in-internet-explorer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!