Keeping URL Fragments when redirecting in Internet Explorer
Asked Answered
N

0

3

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

Notogaea answered 4/3, 2014 at 9:37 Comment(8)
Just noticed that Mr @ericlaw is also taking part at StackOverflow hoping that he has some hints on this.Notogaea
Are you using HTML5 DTD ?Rancho
Yes strict HTML5 lowest IE version to support is IE10.Notogaea
Can you post a sample URL couple (old and new) that are working on FF ?Rancho
You could also try to tease the mentioned user from here... :>Rancho
i posted a sample url. The fragment will saved to a hidden field in a form, will be sent back to the server, and the user will be redirected to a new url including the fragment.Notogaea
Thank you @AndreaLigios i'll have a look at this post it also seems to be a duplicate of my question somehow.Notogaea
Is your LoginSuccessAction a redirectAction itself ? If yes, then you found the problem. If not, keep digging...Rancho

© 2022 - 2024 — McMap. All rights reserved.