1

For some reason I need my website when gets refreshed to be loaded as if it has been opened just right now, that's due to some problem that I have with chrome (other browsers do work just fine) on one of my projects, if you are curious that is the question on stack-overflow.

Chrome does not translate an element on reload

How can I detect the refresh event on chrome, maybe I will come up with something to fix the problem after detecting the refresh event by JavaScript, so detecting refresh event and being able put some code after detection to do some stuff through JS is my question.

Guys the links which you have sent do not answer my question, I have tried them, stop flagging the question, I'm in a tough spot.they don't do anything on chrome just an error and fast refreshing nothing to read...

AbeIsWatching
  • 159
  • 1
  • 11
  • 1
    did you search? https://stackoverflow.com/questions/5004978/check-if-page-gets-reloaded-or-refreshed-in-javascript – epascarello Mar 02 '20 at 20:04
  • Does this answer your question? [Check if page gets reloaded or refreshed in JavaScript](https://stackoverflow.com/questions/5004978/check-if-page-gets-reloaded-or-refreshed-in-javascript) – Huangism Mar 02 '20 at 20:06
  • dude none of them let me right code that is detectable by chrome, yes I used these answers, chrome gives me an error on console and gets reloaded fast I can't even read the error. – AbeIsWatching Mar 02 '20 at 20:07

1 Answers1

0

My solution for this was to set a session token.

    var item = sessionStorage.getItem('pageHasBeenLoaded');
    if (item) {
        console.log('this is a reload');
    }
    sessionStorage.setItem('pageHasBeenLoaded', 'true');
  • Dude, it works, it does detect the refresh but when I refresh my Chrome the bug that I had still lives on, I need a way to force chrome on refresh events to act as if the page has been opened right now. when I open the website first its okay but when I refresh it things go nuts ONLY on Chrome :) – AbeIsWatching Mar 02 '20 at 20:14
  • I fixed my bug but your answer was right, so... thanks. – AbeIsWatching Mar 02 '20 at 21:49