IE9 removes # parts from URLs (works in Firefox!)

I am working on an ASP.NET MVC Routing + AngularJS routing application.

My url looks like:

https://example.com/Request/#/Search/Request/123

when I break it ( http://example.com/Request ) is handled by ASP.NET MVC routing. (Area = Request, controller = "Default", action = "Index")

(# / Search / Request / 123) is processed by AngularJS routing.

This works great when I'm on http: // localhost: 8080 /

The problem is when I deploy this application at https://example.com/

In this case, if the user clicks on the link above (received by email), IE 9 only recognizes ( https://example.com/Request/ ") and the server never receives (# / Search / Request / 123).

We have a corporate SSO implemented on a web server. The SSO client intercepts the HTTP request and uses the URL to redirect to the requested page after authentication.

if the # fragment is not sent as part of the http request url, sso cannot redirect back to the same page.

I believe this is a common scenario / problem. I would continue to change the URL scheme as a last resort. for example (from # to!).

How to solve this?

+4
source share
3

( URL- #) . ( , JavaScript).

RFC 2396 4.1:

URI     , ,    URI ( "#" )         . ,     URI, URI.

( )

URL, , , # . JavaScript , . , , JavaScript , () 100% , .

URL , IMO - , , .

0

, :

http://codetunnel.io/how-to-persist-url-hash-fragments-across-a-login-redirect/

:

JavaScript, - URL- . JQuery

$(function () {
  var $redirect = $('[name="redirect"]');
  $redirect.val($redirect.val() + window.location.hash);
});

,

- URL- .

$(function () {
  var $loginForm = $('#loginForm');
  var actionUrl = $loginForm.attr('action');
  $loginForm.attr('action', actionUrl + window.location.hash);
});
+1

Source: https://habr.com/ru/post/1583774/


All Articles