Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

XiaTesting's avatar

Browser back button and Inertia

Hi all,

Currently struggling with Inertia, is that how do we prevent showing login page after user logged and hit browser back button. Searched many ways, but none of them were satisfactory

Any help would be appreciated.

0 likes
3 replies
Sinnbeck's avatar

An easy fix. Set the inertia request to replace: true

That way the login page is overwritten in browser history

XiaTesting's avatar

@Sinnbeck May I get an example?

How to do it and where to put it?

Sorry, I just started using Inertia recently.

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@XiaTesting sure. An example

Inertia.post('/login', {
  email: email, 
   password: password 
}, {
   replace: true 
} )

Please or to participate in this conversation.