Home>

Holds the value in the cookie in javascript when the screen transitions, and deleted the cookie held in php (server side php) when returning from the transition destination screen, but it is possible to say that Is not it?
I've confirmed that I set it in php and delete it, but I'm wondering if it's okay to mix processes even if javascript and server side php cookies are handled the same way.

setcookie ('hoge', '', time ()-1800);
  • Answer # 1

      

    Holds the value in the cookie with javascript when the screen transitions and deletes the cookie held in php (server side php) when returning from the transition destination screen

    I think the desired behavior is possible, but I don't understand the merit of it.
    I think it's more convenient to control the addition/deletion of cookies on the other hand, but it's convenient, but is there a clear merit of using JS/PHP together?

    I think that adding/deleting cookies in PHP eliminates the risk of JS being disabled and not being executed.

    Re: enigumalu-san

  • Answer # 2

    The requirement is difficult to read, but if you use the same browser, cookies should be shared.
    Try it out and see the changes from your browser development tools.