# Favicon Injection Script(guide)

**URL:** <https://forum.inductiveautomation.com/t/favicon-injection-script-guide/114370>\
**Category:** Ignition\
**Tags:** perspective, scripting\
**Created:** [March 6, 2026, 8:29pm UTC](https://forum.inductiveautomation.com/t/favicon-injection-script-guide/114370 "2026-03-06T20:29:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![travisaggiebrown](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/travisaggiebrown/32/85824_2.png) [@travisaggiebrown](https://forum.inductiveautomation.com/u/travisaggiebrown)\
**Post date:** [March 6, 2026, 8:29pm UTC](https://forum.inductiveautomation.com/t/favicon-injection-script-guide/114370/1 "2026-03-06T20:29:43Z")

</div>

```python
def FaviconLoad(FullMountedPath, self):
	#make the markdown run html and invisable
	self.props.markdown.escapeHtml = False
	self.props.style.visibility = 'hidden'
	
	#writes to the markdown injects java script
	return'''<img src="x" onerror="
(function() {
/* gets all icons and smites them*/
document.querySelectorAll('link[rel*=icon]').forEach(el => el.remove());
/*creates Html link and sets values*/
var link = document.createElement('link');
link.rel = 'shortcut icon';
link.type = 'image/x-icon';
link.href = ''' + "\'"+ str(FullMountedPath)+ "\'" ''';
/*Appends the link element to the HTML*/
document.head.appendChild(link);
/*writes to console to validation */
console.log('Favicon updated via Markdown injection');
})();
">'''

```

I wanted favicons easily, so I made favicons easy here’s the script if anyone wants it, you just have to mount a favicon and call the function with the path to return to a markdown component. enjoy

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [March 6, 2026, 10:52pm UTC](https://forum.inductiveautomation.com/t/favicon-injection-script-guide/114370/2 "2026-03-06T22:52:23Z")

</div>

Was looking at how you're doing it, and are you missing a `+` between the second escaped single quote and the following block quote on the line for `link.href`?

---

<div class="post-metadata">

**Author:** ![travisaggiebrown](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/travisaggiebrown/32/85824_2.png) [@travisaggiebrown](https://forum.inductiveautomation.com/u/travisaggiebrown)\
**Post date:** [March 7, 2026, 1:16am UTC](https://forum.inductiveautomation.com/t/favicon-injection-script-guide/114370/3 "2026-03-07T01:16:11Z")

</div>

yes it would appear i am, which is odd because i ran the code before posting and it ran without issue. i will have to look into it further when im back in office monday.

---

<div class="post-metadata">

**Author:** ![travisaggiebrown](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/travisaggiebrown/32/85824_2.png) [@travisaggiebrown](https://forum.inductiveautomation.com/u/travisaggiebrown)\
**Post date:** [March 9, 2026, 12:52pm UTC](https://forum.inductiveautomation.com/t/favicon-injection-script-guide/114370/4 "2026-03-09T12:52:02Z")

</div>

so, the `+` signs are there and unnecessary I probably forgot to remove that one when I was refactoring and trying to get it to format correctly (can you blame me look at how many quotation marks there are) this is what the line should look like.

`link.href = '''"\'"+ str(FullMountedPath)+ "\'"''';`
