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
04-01-2018 12:55 PM
In Service Portal HTML, you should call the function and then in client controller define the function.
HTML should be
<a href="javascript:void(0)" ng-click="previousPage()">Back</a>
Inside client controller, use
$scope.previousPage = function(){
window.history.back();
}
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2019 06:00 AM
Ran into something similar and Sanjiv's solution worked like a charm!