# How do I prevent multiple pages with the same URL?

**URL:** <https://forum.inductiveautomation.com/t/how-do-i-prevent-multiple-pages-with-the-same-url/80560>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 17, 2023, 1:15am UTC](https://forum.inductiveautomation.com/t/how-do-i-prevent-multiple-pages-with-the-same-url/80560 "2023-10-17T01:15:42Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [October 17, 2023, 1:15am UTC](https://forum.inductiveautomation.com/t/how-do-i-prevent-multiple-pages-with-the-same-url/80560/1 "2023-10-17T01:15:42Z")

</div>

The title says it all 🙂

I don't see anything in the Session props that would indicate how many pages, or which ones are open in a browser.

Is this even possible? Perhaps by storing the Page ID in a `custom.prop` and if a new tab is opened, somehow check to see if the current path is active, then compare the Page ID to... maybe the Page ID would have to be a Session prop then, so it's viewable by the page?

---

<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:** [October 17, 2023, 2:14am UTC](https://forum.inductiveautomation.com/t/how-do-i-prevent-multiple-pages-with-the-same-url/80560/2 "2023-10-17T02:14:08Z")

</div>

Don't be fooled by page ID; in the Designer it is the resource path, but in a Session it is a unique 8 character string. There is no good mechanism for determining what "URL" a session page is using.

Your only avenue might be to enforce a _stricter_ check that only one tab is open, thereby enforcing that there could be no duplicate page with the same URL.

But what is the purpose of this requirement?

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [October 17, 2023, 5:18pm UTC](https://forum.inductiveautomation.com/t/how-do-i-prevent-multiple-pages-with-the-same-url/80560/3 "2023-10-17T17:18:42Z")

</div>

Well, I haven't proved this out yet, but we had an issue where the numbers entered by the user were set to zero in a popup, but the rest of the information was correct. When I took a look at the workstation, there were four tabs open to the same page. What I didn't do was check to see what item was selected, if any, on the other three pages. If someone had selected an item off of another page (and each time an item is selected a popup appears), then another item is selected on another page, the defaults (maybe?) from the first popup might have overridden some of the values on the last popup.

That's my theory so far. And what's more interesting is that this workstation is in kiosk mode, so I am not sure how someone managed to open another page anyway... unless, the workstation was signed out during an OS update and someone signed in using a different login... hmmm.

---

<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:** [October 17, 2023, 5:30pm UTC](https://forum.inductiveautomation.com/t/how-do-i-prevent-multiple-pages-with-the-same-url/80560/4 "2023-10-17T17:30:59Z")

</div>

> [@mdemaris](#):
>
> If someone had selected an item off of another page (and each time an item is selected a popup appears), then another item is selected on another page, the defaults (maybe?) from the first popup might have overridden some of the values on the last popup.

Can you try and clarify this ? It seems you're trying to prevent something from happening by restricting pages, when there might be a different design that would get rid of the issue.

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [October 17, 2023, 6:40pm UTC](https://forum.inductiveautomation.com/t/how-do-i-prevent-multiple-pages-with-the-same-url/80560/5 "2023-10-17T18:40:14Z")

</div>

By selecting an item, I refer to clicking a table row which calls a popup view, passing some params. If this were to happen multiple times in a session, but the Submit button is clicked only once when the user completes their interaction, that's where I'm thinking the data gets "corrupted" so to speak. It's not the actual data the user input, but perhaps data from another instance of the popup. ?

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [October 17, 2023, 7:14pm UTC](https://forum.inductiveautomation.com/t/how-do-i-prevent-multiple-pages-with-the-same-url/80560/6 "2023-10-17T19:14:21Z")

</div>

Wouldn't you want the popup to be modal, in that case?

---

<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:** [October 17, 2023, 8:10pm UTC](https://forum.inductiveautomation.com/t/how-do-i-prevent-multiple-pages-with-the-same-url/80560/7 "2023-10-17T20:10:43Z")

</div>

> [@mdemaris](#):
>
> It's not the actual data the user input, but perhaps data from another instance of the popup?

Unfortunately, you're the only one who can tell us this. There are a thousand different potential reasons you could be getting "corrupted" data and they all relate to how you've implemented the project.

The likely causes are storing your Popup information in Tags or Session properties up until the submission event. Again, you're the only one who can diagnose if these are indeed the cause.

---

<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:** [October 18, 2023, 7:09am UTC](https://forum.inductiveautomation.com/t/how-do-i-prevent-multiple-pages-with-the-same-url/80560/8 "2023-10-18T07:09:53Z")

</div>

Doesn't prevent things happening in another tab, which is I believe what he's scared of.

@mdemaris You'll need to design your inputs and data storage so that it's not an issue.  
How does everything work for now ? Can you maybe share the view ?

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [October 18, 2023, 4:14pm UTC](https://forum.inductiveautomation.com/t/how-do-i-prevent-multiple-pages-with-the-same-url/80560/9 "2023-10-18T16:14:37Z")

</div>

You are correct regarding the modal option. Other tabs can still open.

I did some testing yesterday and was not able to duplicate the issue my user described.

> [@cmallonee](#):
>
> The likely causes are storing your Popup information in Tags or Session properties up until the submission event

Nothing is stored in Tags or Session props at this time, I haven't gotten to that part of the journey yet.

I'll see about putting together something coherent to share here.

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [October 18, 2023, 5:44pm UTC](https://forum.inductiveautomation.com/t/how-do-i-prevent-multiple-pages-with-the-same-url/80560/10 "2023-10-18T17:44:44Z")

</div>

Here is the table from which the user selects the desired item:

 ![Table01](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/3/c3ae3a97f4f8d38eaa51784bc7e79b00d990b3ac.png)

Table action on selected row:

```auto
system.perspective.openPopup("itemSignoutId","Page/inv/itemSignout_PU", params={"p_locid":self.props.selection.data[0].LocID}, showCloseIcon = False, resizable = True, modal = True)

```

This is the popup:  
 ![CheckOut](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/7/c7ed6f6148c5d26ab5d89e23e8e5cb984260d294.png)

Popup props and params: (the auth param is not used)  
 ![CheckOutParams](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/2/42b5e19c7f057b0d9bf2dd63c9a5705cbfa76b21.png)

Submit button code:

```auto
namedQuery = "INV/Item_SignOut_SP"
	if len(self.view.custom.check_out['userName']) <> 0:
		qtyLeft = self.view.custom.check_out['qtyLeft']
		userName = self.view.custom.check_out['userName']
		comments = self.view.custom.check_out['comments']
		qtyTaken = self.view.custom.check_out['qtyTaken']
		transType = self.view.custom.check_out['typeId']
		locId = self.view.custom.loc_id
		
		if qtyLeft == 0:
			self.view.custom.confirm_vis = True
			self.view.custom.RF2 = False
		elif qtyLeft == "":
			self.view.custom.confirm_vis = True
			self.view.custom.RF2 = False
		else:
			params1 = {"p_LocID":locId, "p_Left":qtyLeft, "p_UserName":userName, "p_Comments":comments, "p_Taken":qtyTaken, "p_Type":transType}
			system.db.runNamedQuery(namedQuery, params1)
			system.perspective.closePopup("itemSignoutId")
	else:
		self.parent.parent.getChild("Spacer_1").getChild("lbl_Message").props.text = "Please Fill Required Boxes!"
		self.parent.parent.getChild("Spacer_1").getChild("lbl_Message").meta.visible = True

```

Apologies @pascal.fragnoud I forgot to tag you when I posted this.

---

<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:** [October 18, 2023, 5:59pm UTC](https://forum.inductiveautomation.com/t/how-do-i-prevent-multiple-pages-with-the-same-url/80560/11 "2023-10-18T17:59:47Z")

</div>

Which field(s) are actually giving "corrupted" data on submission?

One quick trouble-shooting step would be to place a button within that Popup which does nothing more than print out the values of the custom properties. Try opening this Popup in multiple tabs and see if you're getting unexpected values. Don't forget to modify some fields in other tabs before opening the Popup again in a different tab.

Also, it looks like your Designer has _some of_ the custom properties set to be persistent, which means that the Popup will open with those same values you see in the Designer. If you don't want those values used as the default every time the Popup is opened, then you need to set the properties to not be persistent (right-click each property, then un-select the Persistent checkbox). The relevant properties from you script seem to be non-persistent, so this is likely not your issue.

I don't see anywhere that you're setting values to be `0`, so I am confused as to where the `0` values could be coming from. Are these Text Fields, or Numeric Entry Fields? ~~I don't believe Numeric Entry Fields allow for empty string values, and will always replace it with `0`. Perhaps this is your issue? As you're dealing with numeric values, this seems likely.~~

---

<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:** [October 18, 2023, 6:10pm UTC](https://forum.inductiveautomation.com/t/how-do-i-prevent-multiple-pages-with-the-same-url/80560/12 "2023-10-18T18:10:07Z")

</div>

This might be something you'll need to contact Support about, as the explanation/solution here is likely going to require an in-depth examination of the structure of the View, and potentially a real-time replication.

At least one alternate approach might help you:  
If you want to enforce that only one instance of this Popup should be open for a given session, you can take control of managing its state yourself. This would require you do NOT use the default `closeIcon` (which you're already doing) and you instead provide your own button within the View for closing the Popup.

Your code for opening the Popup should check against a session property which tracks when the Popup has been opened

```auto
if not self.session.custom.addl_details_popup_open:
    self.session.custom.addl_details_popup_open = True
    system.perspective.openPopup("itemSignoutId","Page/inv/itemSignout_PU", params={"p_locid":self.props.selection.data[0].LocID}, showCloseIcon = False, resizable = True, modal = True)

```

The buttons which would CLOSE the Popup should set the session prop to false BEFORE closing the Popup:

```auto
self.session.custom.addl_details_popup_open = False
system.perspective.closePopup(id="itemSignoutId")

```

This would make it so that a single user can only open one instance of the Popup within their session.

---

<div class="post-metadata">

**Author:** ![mdemaris](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mdemaris/32/54639_2.png) [@mdemaris](https://forum.inductiveautomation.com/u/mdemaris)\
**Post date:** [October 19, 2023, 10:11pm UTC](https://forum.inductiveautomation.com/t/how-do-i-prevent-multiple-pages-with-the-same-url/80560/13 "2023-10-19T22:11:35Z")

</div>

I like this idea, and it works well.

One thing I noticed, if I open another browser, without logging out of the first browser, the session ID's are the same, and it does prevent opening the popup, however after the popup is closed, I cannot reopen it in the second browser.

Well, I cannot reproduce this phenomenon, so it may be a moot point.

> [@cmallonee](#):
>
> I don't see anywhere that you're setting values to be `0`

Regarding this, the zero is auto-populated in the Numeric Entry Field, as I set the `value` to be empty, as in I deleted anything in the `value` prop. So this:

> [@cmallonee](#):
>
> I don't believe Numeric Entry Fields allow for empty string values, and will always replace it with `0`.

is TRUE.

There are no `value.onChange` scripts, so I believe that when I click Submit, `0` is the value applied to the numeric field or at least applied to the variable that is assigned to that field in the Submit script (above):

> [@cmallonee](#):
>
> _some of_ the custom properties set to be persistent

I'm glad you mentioned this as well, as there are two props that should not be persistent, though it does not seem to affect the operation of the of popup because they are bound to a query and or the results of the query.

---

<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:** [October 19, 2023, 10:21pm UTC](https://forum.inductiveautomation.com/t/how-do-i-prevent-multiple-pages-with-the-same-url/80560/14 "2023-10-19T22:21:50Z")

</div>

> [@mdemaris](#):
>
> if I open another browser, without logging out of the first browser, the session ID's are the same,

It doesn't matter how many browser windows you open _of the same browser_, they will all share the same sessionId. If you open an incognito/private browser window, or a _different_ browser, they will each get their own sessionId.
