Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

IE8 in html5Mode reload the page to add hash and server loose GET parameters and path #6195

Closed
nolazybits opened this issue Feb 10, 2014 · 5 comments
Assignees

Comments

@nolazybits
Copy link
Contributor

So the problem has been described really well on stackoverflow by another user
http://stackoverflow.com/questions/20884640/angularjs-and-php-routing-in-ie9-doesnt-work/21667795#21667795

Copy pasting it here.


I have an application with routing on php. Here is the simple example:

$req=$_SERVER['REQUEST_URI'];
if(strpos($req, '/items/') === 0){
    include __DIR__.'/../views/items/index.php';
} else{
    include __DIR__.'/../views/login/index.php';
}

on each page (items and login) angularjs routing is used. And all works perfectly except IE9 and below. After page load, angular updates url and reloads the page for routing with hash navigation. And I get the following problem in IE:

  • enter url = /items/23
  • server returns page items/index.php
  • Algularjs changes url to /#!/items/23
  • Server cannot read data after hash symbol, and think that url is / so it returns page login/index.php

I have a similar problem where my php page does some redirection (well, includes) depending on $_GET variables or path. One of the redirection (include) is the angularjs app itself.

@nolazybits
Copy link
Contributor Author

I've come with a workaround (for the IE8 workaround), by adding cookies before reloading the page if in IE8.

$location.pathInCookie(false/true);
$location.pathInCookieName('CookieNameToUse');

I will push the change on my fork.
I would love to get some help to create the test case for those.
Regards.

@nolazybits
Copy link
Contributor Author

Pull request created here
#6303

@IgorMinar
Copy link
Contributor

@zeflasher thanks for the PR but as I commented there this change is not desirable because it's not aligned with the responsibilities of $location service.

I think that you should show the login screen based on the login credentials and not the url entered. So if a request comes in, check if the user is authenticated and authorized to access given resource/page and if everything is ok proceed. Otherwise redirect the request to the login page or 403 page. This is a common practice and people often deal with this using serverside request filters or interceptors.

@nolazybits
Copy link
Contributor Author

Hello Igor,

This as nothing to do with the process (btw we are doing exactly this, each app check credential and if not logged in redirect to the login screen with token attached). The problem is that parameters sent to the application are getting lost because of the refresh done by the IE8 html5mode workaround. Please See pull request for more details.

The workaround remove normal functionality. We should at least give the developer a way around it (again please see the comment on the linked pull request)

Cheers,
Xavier

@chrisdhanaraj
Copy link

Kind of checking in - zeflasher, did you ever get a solution to this problem? Running into the same issue here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants