# 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:** 1\
**Showing post:** 2

<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.

---

_[View the full topic](https://forum.inductiveautomation.com/t/url-update-during-page-interaction/102438)._
