# How to handle chrome reload

**URL:** <https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [November 25, 2024, 6:30am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052 "2024-11-25T06:30:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dharani\_T](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dharani\_T](https://forum.inductiveautomation.com/u/Dharani_T)\
**Post date:** [November 25, 2024, 6:30am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/1 "2024-11-25T06:30:30Z")

</div>

Hi,

Is there a way to manage the navigation icons and refresh icon in Chrome? When I click on them, the values on the pages appear incorrect. Is there any session or gateway event that can address this issue?  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/9/a91ad3e7e021d2b7b5dab599e032a92133eec7cd.png)  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![David\_Stone](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/david_stone/32/79749_2.png) [@David\_Stone](https://forum.inductiveautomation.com/u/David_Stone)\
**Post date:** [November 25, 2024, 8:14am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/2 "2024-11-25T08:14:05Z")

</div>

Half the concept of javascript security and usability require there to be no way for a malicious script to disable or remove functionality like these buttons.  
As a result, short of recording the use of the buttons and trying to minimise the detrimental effects on sessions, I am not sure you will have much luck.

If you can elaborate on situations where values become incorrect, it would help us diagnose and suggest possible solutions.

---

<div class="post-metadata">

**Author:** ![Dharani\_T](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dharani\_T](https://forum.inductiveautomation.com/u/Dharani_T)\
**Post date:** [November 25, 2024, 8:57am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/3 "2024-11-25T08:57:58Z")

</div>

I have a screen (e.g., `url:/xyz`), and when the user clicks on it, they navigate to another view (View 2) where a back button is provided. In this scenario, the user should enter some data before going back, and this is handled by the back button where the data is saved.

However, I'm concerned about what happens if the user refreshes the page or clicks the browser's back/forward buttons. How can I handle this situation?

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 25, 2024, 11:42am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/4 "2024-11-25T11:42:59Z")

</div>

You cannot prevent the user from leaving the page.

You could however in an OnShutdown Event in your components, try to deteect if everything was filled in or not. And than have some sort of popup open in your project where they have to fill in all the missing data...

This probably wont catch everything though

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [November 25, 2024, 12:54pm UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/5 "2024-11-25T12:54:11Z")

</div>

Why not provide your own back button to try to avoid the user using the browser buttons? You'll never stop them from using them unless you make them use the perspective apps.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 25, 2024, 12:56pm UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/6 "2024-11-25T12:56:47Z")

</div>

being forced to do something when leaving is kinda weird, but idk the situation

---

<div class="post-metadata">

**Author:** ![Dharani\_T](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dharani\_T](https://forum.inductiveautomation.com/u/Dharani_T)\
**Post date:** [November 27, 2024, 5:44am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/7 "2024-11-27T05:44:12Z")

</div>

We have already provided a back button, but what if he clicks \<- in chrome.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [November 27, 2024, 7:58am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/8 "2024-11-27T07:58:45Z")

</div>

No way to control that besides making them use perspective workstation.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [November 27, 2024, 8:10am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/9 "2024-11-27T08:10:40Z")

</div>

Why does the user need to provide data when going back to the previous page ?

---

<div class="post-metadata">

**Author:** ![Dharani\_T](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dharani\_T](https://forum.inductiveautomation.com/u/Dharani_T)\
**Post date:** [November 27, 2024, 9:46am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/10 "2024-11-27T09:46:14Z")

</div>

Thats the logic expected by user.  
My only doubt here is, do we have any options in ignition to handle reload like we have startup/shutdown events?

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 27, 2024, 10:26am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/11 "2024-11-27T10:26:06Z")

</div>

Browsers block almost all interference with reloads and navigates.  
As this is a security hazard.

If you give more details about why and what your users need to do before leaving, maybe there is a way to achieve this nonetheless with the limited functions there are.

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [November 27, 2024, 10:47am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/12 "2024-11-27T10:47:28Z")

</div>

I often get confronted with an "Are you sure you want to leave" popup on many sites when I attempt to navigate away from an unfinished form.

How is that done? Something like that would solve the problem here.

Beyond that, I imagine a simple label advising the user against using the browser's nav buttons would be helpful.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [November 27, 2024, 11:45am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/13 "2024-11-27T11:45:20Z")

</div>

Yes that would ask a confirm button, but they can still always leave.  
Also not sure if it would work with react routing for navigation, but it should work with reload.

Something like this probably? in a binding on markdown component where escape html is off. (untested)

```python
	code = """<img style='display:none' src='/favicon.ico' onload=\"
		const beforeUnloadHandler = (event) => {
			event.preventDefault();
			event.returnValue = true;
		};
  		if ("""+value+""") {
			window.addEventListener('beforeunload', beforeUnloadHandler);
		} else {
			window.removeEventListener('beforeunload', beforeUnloadHandler);
		}
	\"></img>""".replace("\n", "").replace("\t", "")
	return code

```

There are serveral issues with this though...

- Does not work on all browsers,
- Only shows a default message,
- Might stay attached to the whole session, if binding didnt get to remove the event. (reload should fix probably),
- Might not work with persective navigate

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 27, 2024, 12:31pm UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/14 "2024-11-27T12:31:18Z")

</div>

You might find my `pageVarMap()` functions useful for such cases (from my Integration Toolkit).

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [November 27, 2024, 3:48pm UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/15 "2024-11-27T15:48:54Z")

</div>

What if you renamed your back button to "Save" so that the user realizes they must click that button for the values to be saved, and it just happens to also go back to the previous page.

---

<div class="post-metadata">

**Author:** ![Dharani\_T](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dharani\_T](https://forum.inductiveautomation.com/u/Dharani_T)\
**Post date:** [November 28, 2024, 7:07am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/16 "2024-11-28T07:07:43Z")

</div>

How to import the integration toolkit to my project?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 28, 2024, 11:00am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/17 "2024-11-28T11:00:36Z")

</div>

1. Download the .modl file.
2. Gateway | Config | SYSTEM | Modules | Install or Upgrade a Module ...

Download (at bottom of page):  
[https://www.automation-pros.com/modulesales.html](https://www.automation-pros.com/modulesales.html)

Documentation:  
[https://www.automation-pros.com/toolkit/doc/](https://www.automation-pros.com/toolkit/doc/)

---

<div class="post-metadata">

**Author:** ![Dharani\_T](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dharani\_T](https://forum.inductiveautomation.com/u/Dharani_T)\
**Post date:** [November 28, 2024, 11:02am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/18 "2024-11-28T11:02:56Z")

</div>

I dont see download option in below link,  
[https://www.automation-pros.com/toolkit/doc/index.html#reflection](https://www.automation-pros.com/toolkit/doc/index.html#reflection)  
Could u please guide me?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 28, 2024, 11:05am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/19 "2024-11-28T11:05:30Z")

</div>

Read my post again.

---

<div class="post-metadata">

**Author:** ![Dharani\_T](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dharani\_T](https://forum.inductiveautomation.com/u/Dharani_T)\
**Post date:** [November 28, 2024, 11:10am UTC](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052/20 "2024-11-28T11:10:22Z")

</div>

Got it.

[Next page](https://forum.inductiveautomation.com/t/how-to-handle-chrome-reload/99052.md?page=2)
