Question

JavaScript in an Article

  • 30 November 2021
  • 4 replies
  • 564 views

Userlevel 1
Badge

I’d like to make a simple calculator type application in a Solutions article. I want to allow customers to be able to enter a couple fields in and I’d spit out an answer. I tried just adding some <script> </script> in with a simple call, but it just gets displayed as code.

I want the JavaScript to execute instead of just being displayed.


4 replies

Userlevel 5
Badge +7

Hello @tmullanix -- glad to have you on here, welcome! :clap_tone3:

 

Is this something you’re trying to do so for an article hosted on Freshdesk (can you confirm the product for us?) I’m afraid execution of Javascript is prohibited on solution articles, as per my infrastructure knowledge, but I’ll move this over to the Freshdesk space.

 

Tagging @hemanth.ramya and @Keer, for some insights.

Userlevel 1
Badge

Thanks for moving this to a better location!

Yes, we have many articles in the Solutions section of FreshDesk and want to execute JavaScript in one of them. The JavaScript will basically be a calculator type application. It actually will be used to show several distances based on the type of camera lens being selected.

Userlevel 5
Badge +9

Thanks for sharing your usecase, @tmullanix.

You can make use of the portal customization feature in Freshdesk to achieve your requirements. This can be done from under Admin > Portal > Customize portal with the help of your developers. Kindly refer to this link to get detailed insights on the same.

Alternately, we can loop in our third party system integrators to help you on your customization request. Feel free to drop an email to support@freshdesk.com in case you need our assistance.

 

Cheers,

Hey!  Sorry for reviving an old article.  I’m trying to do the same thing, but am running into a problem.

 

I’ve gone into Admin > Portal > Customize Portal and have added this trivial bit at the bottom of the article theme:

<script>
document.addEventListener('DomContentLoaded', function(event){
alert('abc');
});
</script>

 

This code, unfortunately never executes.  Related, in the console, there’s an error native to a FreshDesk script at https://lemonadelxp.freshdesk.com/assets/cdn/portal/scripts/integrations.js which fails at ‘undefined is not an object evaluating c.token’.

 

Was your mileage a bit different?  What’s this token error?

 

Thanks!

 

Reply