0

My goal is to do some javascript action the moment the user clicks the browser's refresh button.

I've tried:

Function and Global Variable Declaration

function pageunload(){
alert('here');
};

Execute when Page Loads

window.addEventListener('beforeunload', pageunload);

I know that the 'addEventListener' is working properly but the event is not the right one.

I have also tried to dynamic action "before Refresh", but I haven't been able to associate it to the page level, only items/regions etc.

ItzBunzy
  • 11
  • 5
  • 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) – Koen Lostrie Mar 18 '21 at 15:41
  • What sort of JS would this activity invoke? – Scott Mar 18 '21 at 23:38
  • @KoenLostrie It's not exactly what I was looking for, but enabled me to solve my issue. Thank you very much! – ItzBunzy Mar 22 '21 at 18:11

2 Answers2

1

In the page attribute you can write Javascript on Page Load which will be executed when the page is reloaded or submitted.

enter image description here

0

beforeunload is the opposite of what you want

  • Use the load event

  • Check Mohamad image

  • Create a dynamic action for page Load

Paulo Künzel
  • 729
  • 2
  • 7
  • 30