Service Portal: Javascript in HTML Widget
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2018 04:48 AM
Hi,
Is it possible to use Javascript in the stock HTML widget?
I am trying to create a hyperlink in text that would take users back one page and I was thinking to use Javascript for that purpose (history.back()), but whenever I put that in the HTML, it gets formatted out and doesn't work.
Perhaps there is a better way to achieve that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2018 08:29 AM
Hi
Try below in HTML template.
<a href="javascript:void(0);" onClick="Return();">Back</a>
<script>
function Return(){
window.history.back();
}
</script>
Thanks
Please Hit ✅Correct, ⭐️Helpful depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2018 03:25 AM
It doesn't work. If I add it using 'View source code' option and save it, the editor automatically removes the <script> tag and its contents as well as it reduces <a> tag to only the opening and closing tag with no parameters.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2018 06:37 AM
Can you share screen shot..
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-23-2025 02:22 AM
Hello, @warciech I am also running into same issue where I am not able to add script in the source code. Can you please let me know if you found any solution for this? Thank you.