# Navigate to another page after user is inactive for some time

**URL:** <https://forum.inductiveautomation.com/t/navigate-to-another-page-after-user-is-inactive-for-some-time/83834>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [January 5, 2024, 9:35am UTC](https://forum.inductiveautomation.com/t/navigate-to-another-page-after-user-is-inactive-for-some-time/83834 "2024-01-05T09:35:16Z")\
**Posts on this page:** 3\
**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:** [January 5, 2024, 9:35am UTC](https://forum.inductiveautomation.com/t/navigate-to-another-page-after-user-is-inactive-for-some-time/83834/1 "2024-01-05T09:35:16Z")

</div>

Hi,

I would like to navigate to another screen, whenever the user is inactive for more than 2 mins.I have explored using lastactivity sessionproperty (Current time - last active time) but unable to achieve the desired output as the script not triggered at all time.  
Is there any option to achieve this?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Subin\_Adhikari](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Subin\_Adhikari](https://forum.inductiveautomation.com/u/Subin_Adhikari)\
**Post date:** [January 5, 2024, 3:07pm UTC](https://forum.inductiveautomation.com/t/navigate-to-another-page-after-user-is-inactive-for-some-time/83834/2 "2024-01-05T15:07:33Z")

</div>

For the same problem I used a Change Script in a Label in a Dock, the label has a binding to display the Current time and works as a Status Bar Timer,  
The change script of that Label should always trigger, did you try that? try implementing the logic in the Change Script.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [January 5, 2024, 3:55pm UTC](https://forum.inductiveautomation.com/t/navigate-to-another-page-after-user-is-inactive-for-some-time/83834/3 "2024-01-05T15:55:19Z")

</div>

This setup will navigate all ages of a session to a specified page (`timeout_page`) after the user has been "inactive" for 120 seconds. Note that "inactive" means they have not clicked within the session; it has nothing to do with mouse movement, and so a user might actively be moving their mouse around the page and it will not register as activity.

1. Place a custom session property.
2. Bind this new custom session with an Expression binding: `((now(1000)-{session.props.lastActivity})/1000)>120`
3. Place a change script on this new property:

```python
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
	timeout_page = "/page/config/url/to/page/with/leading/slash"
	if currentValue and currentValue.value: # 120 seconds has elapsed
		for session in system.perspective.getSessionInfo():
			if session.id == self.session.props.id:
				for pageId in session.pageIds:
					system.perspective.navigate(page=timeout_page, sessionId=session.id, pageId=pageId)

```

The `pageId` part is important as the session property won't have a page thread to act on; specifying a pageId directs it to act on the page itself.
