Keeping URL Fragments when redirecting in Internet

2019-04-12 07:32发布

问题:

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