Welcome Guest, Not a member yet? Register   Sign In
[RedirectClass] toReferrer
#1

In my project is is likely users will open multiple tabs but continue navigating on the original tab. In this case, using redirect()->back() produces unexpected behavior. Example

  • user opens /list/
  • user opens /list/item/1 in a new tab (in background)
  • user posts form on /list
  • controller handles form posts and does a
    Code:
    redirect()->back()

  • user is now redirected back to /list/item/1 since it is the last visited url in the session
The behaviour of
Code:
redirect()->back()
is well documented and I understand the choice to use the session for safety.

However, would there be enough of a use case to add  a
Code:
redirect()->toReferrer()

function to cover the case I just described? Of course, this would be not much more than a convenience function as the functionality can already be achieved with other functions from the framework.

I would be happy to open a PR.
Reply
#2

HTTP_REFERER is not reliable.
So if you want to use it, redirect()->to($referer) by yourself.
Reply
#3

There is no need to use back() or referer in the first place.
You can just specify the URI in the controller.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB