# "Page URL" Check

**URL:** <https://forum.inductiveautomation.com/t/page-url-check/83966>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [January 9, 2024, 2:07pm UTC](https://forum.inductiveautomation.com/t/page-url-check/83966 "2024-01-09T14:07:42Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![tecnoeletronic](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tecnoeletronic/32/50975_2.png) [@tecnoeletronic](https://forum.inductiveautomation.com/u/tecnoeletronic)\
**Post date:** [January 9, 2024, 2:07pm UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/1 "2024-01-09T14:07:42Z")

</div>

Hello,

is there a way to know if a "Page URL" is active/configured using expressions or scripts? I would need this to enable/disable commands based on whether the reference URL exists or not.

---

<div class="post-metadata">

**Author:** ![tecnoeletronic](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tecnoeletronic/32/50975_2.png) [@tecnoeletronic](https://forum.inductiveautomation.com/u/tecnoeletronic)\
**Post date:** [January 10, 2024, 8:06am UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/2 "2024-01-10T08:06:11Z")

</div>

I found a solution that works for Perspective pages using "chromedriver" and "selenium".  
Its a little bit tricky but it works.

---

<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 10, 2024, 2:37pm UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/3 "2024-01-10T14:37:43Z")

</div>

While you provided a solution, it's not a good one. Use the 1st party provided functions to get the job done. [system.perspective.getProjectInfo](https://docs.inductiveautomation.com/display/DOC81/system.perspective.getProjectInfo#:~:text=in%20the%20project.-,pageConfigs,-An%20array%20of) will provide a list of all page configurations for the project, which sounds like what you're looking for as it contains the configured mounted paths (project URLs).

---

<div class="post-metadata">

**Author:** ![tecnoeletronic](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tecnoeletronic/32/50975_2.png) [@tecnoeletronic](https://forum.inductiveautomation.com/u/tecnoeletronic)\
**Post date:** [January 10, 2024, 3:18pm UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/4 "2024-01-10T15:18:22Z")

</div>

Thank!! i’m going to try it!

---

<div class="post-metadata">

**Author:** ![tecnoeletronic](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/tecnoeletronic/32/50975_2.png) [@tecnoeletronic](https://forum.inductiveautomation.com/u/tecnoeletronic)\
**Post date:** [January 10, 2024, 3:35pm UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/5 "2024-01-10T15:35:11Z")

</div>

Ok! it works!

---

<div class="post-metadata">

**Author:** ![jacob.ramirez](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@jacob.ramirez](https://forum.inductiveautomation.com/u/jacob.ramirez)\
**Post date:** [February 22, 2024, 6:40pm UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/6 "2024-02-22T18:40:45Z")

</div>

So for that function, it says it works from a Gateway scope but I'm getting this error in the logs calling that function from a timer script.

Caused by: java.lang.IllegalArgumentException: No perspective session attached to this thread.

---

<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:** [February 22, 2024, 6:55pm UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/7 "2024-02-22T18:55:06Z")

</div>

Could you provide your code?

---

<div class="post-metadata">

**Author:** ![jacob.ramirez](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@jacob.ramirez](https://forum.inductiveautomation.com/u/jacob.ramirez)\
**Post date:** [February 22, 2024, 7:30pm UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/8 "2024-02-22T19:30:16Z")

</div>

system.util.getLogger("ProjectInfo").info(str(system.perspective.getProjectInfo()))

---

<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:** [February 22, 2024, 9:06pm UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/9 "2024-02-22T21:06:21Z")

</div>

Got it. The function returns information about the project being used _by a Session_. When executed by any non-Perspective context, the function has no idea what project to return data about.

---

<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:** [February 22, 2024, 9:15pm UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/10 "2024-02-22T21:15:13Z")

</div>

I've reached out to the Documentation team to see about clarifying the docs.

---

<div class="post-metadata">

**Author:** ![jacob.ramirez](https://avatars.discourse-cdn.com/v4/letter/j/9dc877/32.png) [@jacob.ramirez](https://forum.inductiveautomation.com/u/jacob.ramirez)\
**Post date:** [February 22, 2024, 9:23pm UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/11 "2024-02-22T21:23:58Z")

</div>

Gotcha. Thank you for updating the documentation team.

---

<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:** [February 24, 2024, 12:11am UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/12 "2024-02-24T00:11:50Z")

</div>

The [Docs](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-perspective/system-perspective-getProjectInfo) appear to be updated to reflect that Gateway is not a valid scope for this function.

---

<div class="post-metadata">

**Author:** ![Thilagavathi\_M](https://avatars.discourse-cdn.com/v4/letter/t/e19adc/32.png) [@Thilagavathi\_M](https://forum.inductiveautomation.com/u/Thilagavathi_M)\
**Post date:** [August 2, 2024, 4:17pm UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/13 "2024-08-02T16:17:30Z")

</div>

Dear team,

I have one doubt?  
In Vision, to find out how long a particular window has been open, there's a 'System.gui.getWindow' function. Is there any similar function to determine how long a particular view has been open in perspective?

---

<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:** [August 2, 2024, 4:19pm UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/14 "2024-08-02T16:19:07Z")

</div>

No, but it's not hard to implement by yourself using `now(0)`.  
But what exactly are you trying to do ?

---

<div class="post-metadata">

**Author:** ![Thilagavathi\_M](https://avatars.discourse-cdn.com/v4/letter/t/e19adc/32.png) [@Thilagavathi\_M](https://forum.inductiveautomation.com/u/Thilagavathi_M)\
**Post date:** [August 3, 2024, 3:32am UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/15 "2024-08-03T03:32:16Z")

</div>

I have 10 views in Perspective, and I need to get the value of which view the user opens and how long it has been open. I can use `page.props.path` in the onStartup script, but that would require doing it individually for each screen. I don't want to do it that way. I need to make it dynamic with one script so that I can know which screen the user is using and for how long.

---

<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:** [August 3, 2024, 3:43pm UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/16 "2024-08-03T15:43:04Z")

</div>

Use a shared docked view. Put the check for `page.props.path` there.

---

<div class="post-metadata">

**Author:** ![Thilagavathi\_M](https://avatars.discourse-cdn.com/v4/letter/t/e19adc/32.png) [@Thilagavathi\_M](https://forum.inductiveautomation.com/u/Thilagavathi_M)\
**Post date:** [August 6, 2024, 10:16am UTC](https://forum.inductiveautomation.com/t/page-url-check/83966/17 "2024-08-06T10:16:28Z")

</div>

Thank You! It works
