Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

144
Vistas
Remove ability to edit data if person refreshes page / visits from another tab?

imgur has an interesting feature where

  • you can create a post using https://imgur.com/upload
  • after the upload finishes, you will be redirected to the post's page where you can edit the title as much as you want. If you refresh the page / visit it in another tab--the ability to edit the title is gone.

How is Imgur doing this? My guess is cookies are involved somehow, but I'm not sure.

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

  • With PHP, you can use $_SESSION to achieve this
  • With JS, you can use localStorage to achieve this
  • With JS, you can use URLSearchParams to achieve this
  • with next/react, you can use useState to achieve this

On Create save the id of the editable resource, on Render if it matches enable edit and reset the saved editable id.

  • You can fake the redirect, which means showing the edit page and putting the view page into the URL

  • on redirecting, set a cookie: https://remix.run/docs/en/v1/api/remix#redirect

    return redirect(`resource/$id`, {
         headers: {
          "Set-Cookie":  `editable:$id`,
         },
    });

Then, use the Cookie API to check that cookie.

about 4 years ago · Juan Pablo Isaza Denunciar

0

you can check for the navigation type. see the answer from @Илья Зеленько on https://stackoverflow.com/a/53307588/14250290

the types you're looking for are reload and back_forward you probably want to have something happen in the backend happen as well to prevent a malicious user.

Another option would be to send a token from the backend when a post is made and in order to edit a post that exact token would need to be sent back. Just don't save the token in anything that persists and on a refresh or new tab it'll be yeeted.

about 4 years ago · Juan Pablo Isaza Denunciar

0

If you do not want to use cookies or session than one way to achieve this is by using useState. update the state when post is created/upload to true(initially false). When user will refresh the page then that state will automatically be false because the component is rendered just now. Note:- If you do not want to use state you can use redux also to achieve this solution. After that use that state or redux state to to enable/disable the ability to edit the post.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda