# URL Update during page interaction

**URL:** <https://forum.inductiveautomation.com/t/url-update-during-page-interaction/102438>\
**Category:** Ignition\
**Tags:** perspective, ignition81\
**Created:** [February 17, 2025, 4:10pm UTC](https://forum.inductiveautomation.com/t/url-update-during-page-interaction/102438 "2025-02-17T16:10:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Benjamin\_Furlani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/benjamin_furlani/32/66084_2.png) [@Benjamin\_Furlani](https://forum.inductiveautomation.com/u/Benjamin_Furlani)\
**Post date:** [February 17, 2025, 4:10pm UTC](https://forum.inductiveautomation.com/t/url-update-during-page-interaction/102438/1 "2025-02-17T16:10:24Z")

</div>

I want to update a URL based on an interaction from within a page.

Example:  
A user selects a new asset from a selector on the page. The page has a path like so: `/general/equipmentDashboard/:assetId` It uses the last selected asset id if you just navigate to `/general/equipmentDashboard`. I am trying to do something similar to how the forum updates the active url from your scroll down in the page for which reply you are looking at.

The only way I think I can update the actual URL is from the `system.perspective.navigate` function which always triggers a reload essentially. This goes for using the `/:assetid` or `?assetid=someid`.

Has anyone else done something like this?

---

<div class="post-metadata">

**Author:** ![Felipe\_CRM](https://avatars.discourse-cdn.com/v4/letter/f/dfb087/32.png) [@Felipe\_CRM](https://forum.inductiveautomation.com/u/Felipe_CRM)\
**Post date:** [February 17, 2025, 7:30pm UTC](https://forum.inductiveautomation.com/t/url-update-during-page-interaction/102438/2 "2025-02-17T19:30:52Z")

</div>

The only way I saw of doing this was using JS, which isn't doable in Perspective without either custom modules or JS injection ([long story](https://forum.inductiveautomation.com/t/exchange-resource-to-use-javascript-with-perspective/81937)). I decided to play around with @victordcq's JS injections and made a little markdown component that, when loaded, will use `history.replaceState` to replace the end of the current URL with whatever is in its `suffix` custom property.

> **Markdown component JSON**
>
> ```python
> [
> {
> "type": "ia.display.markdown",
> "version": 0,
> "props": {
> "markdown": {
> "escapeHtml": false
> }
> },
> "meta": {
> "name": "Markdown"
> },
> "position": {
> "x": 300,
> "y": 347,
> "height": 200,
> "width": 200
> },
> "custom": {
> "suffix": "foobar"
> },
> "propConfig": {
> "props.source": {
> "binding": {
> "type": "property",
> "config": {
> "path": "this.custom.suffix"
> },
> "transforms": [
> {
> "code": "\tdef getRawUrl(path):\n\t\treturn path[:path.rindex('/')+1]\n\t\n\tcode = \"\"\"<img style='display:none' src='/favicon.ico' onload=\\\"\n\t\t\thistory.replaceState(null,null,'\"\"\"+getRawUrl(self.page.props.path)+value+\"\"\"');\t\t\t\t\n\t\t\t\\\"></img>\"\"\".replace(\"\\n\", \"\").replace(\"\\t\", \"\")\n\treturn code",
> "type": "script"
> }
> ]
> }
> }
> }
> }
> ]
> 
> ```

This isn't exactly supported usage so use at your own risk, don't paste random JS into your projects unless you understand it, and so on.

---

<div class="post-metadata">

**Author:** ![Benjamin\_Furlani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/benjamin_furlani/32/66084_2.png) [@Benjamin\_Furlani](https://forum.inductiveautomation.com/u/Benjamin_Furlani)\
**Post date:** [February 17, 2025, 7:33pm UTC](https://forum.inductiveautomation.com/t/url-update-during-page-interaction/102438/3 "2025-02-17T19:33:20Z")

</div>

I kind of figured this was the case. I have a module I could add this too that has some perspective components, but I was hoping for an out of the box.

Thanks for your reply.

---

<div class="post-metadata">

**Author:** ![Benjamin\_Furlani](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/benjamin_furlani/32/66084_2.png) [@Benjamin\_Furlani](https://forum.inductiveautomation.com/u/Benjamin_Furlani)\
**Post date:** [February 19, 2025, 9:52pm UTC](https://forum.inductiveautomation.com/t/url-update-during-page-interaction/102438/4 "2025-02-19T21:52:29Z")

</div>

I feel a bit dumb, but I figured it out.

`system.perspective.navigate(page="myPath/:whateverVariable")` it works. I don't know why I didn't try page the other day. I was using url 🤡
