Integrated developer portal: import js in body tag

payalgilda
Participant I

Hi,

I am trying to use external API reference documentation in my integrated developer portal.
(https://github.com/Rebilly/ReDoc).

For this, javascript needs to be imported inside the body tag. I am aware of the setting -> Custom Script where I can put all javascripts but it adds them before body.

Is there any way I can import javascript inside body tag?

Thanks!

0 4 729
4 REPLIES 4

Hello Payal,

We do not officially support injection of Javascript blocks into the body element, but you may be able to hack in a solution using the custom Javascript page load API (https://docs-new.apigee.com/custom-scripts).

Essentially you would create a blank page and setup an onLoad trigger for that page that uses Javascript to inject the elements into the body tag when the page loads, and remove them when the page unloads.

There are quite a few unknowns here with how this will interact with the Javascript system as it exists in the portal, so I cannot guarantee this will work, and would not be a setup we could support.

JohnnyBee
Participant II

Hi @payalgilda,I have a solution for this, if it is not already implemented.

Hi @JohnnyBee  Can you please suggest how to create few "Pages", where i can use <script> to call a RestAPI.  

 

Thanks,

Sanjeev

Hi @SanjeevT , you need to know, that all of your custom JS code wll be available in devtools of your browser for all users, so I do not advise to you keep there sensitive information (creds, api keys, etc).
Can you share please an example of what you exactly need so I have a sense of direction?