Custom Code options

Hi,
I am pleased to see the new Custom Code options however some improvement is still needed. Currently any Custom Code is only possible across the whole application and it would be useful to add code to specific pages and in specific containers.
I previously requested this and an issue was created here.

Many thanks,

Hans

Hey @beached, I’ve shared your idea with the Application Builder team to check :slightly_smiling_face:

Maybe I don’t understand how the new custom code options work.

I see you can add custom Javascript or CSS in the application settings, but how do you position the element on your site/app?

For example JS that shows a search box at the top of the page, or JS for a map embed at the bottom of the page.

As you can include any javascript, you can also add the missing DOM elements to a page if you want. You also access the current page path to match only certain pages for instance. However we’ll add a way to specify an id/class to an existing element to better target these elements. This way you should be able to target the element you want.

However it can be dangerous to modify the DOM of the elements as it could conflict with the technology we are using to generate it (vuejs). May be it’s safer to include your specific code using the Iframe element and using the messaging system (using custom js) or the IFRame path to interact with the content in this IFrame, what do you think?

Thanks for your reply. I was just reading that it is possible for the Javascript to insert the new DOM and to select an existing DOM to place either before or after. This is useful.

It is great to see the progress however the current setup only allows JS sitewide and in many cases it would only be used on individual pages. I think it would also be better and perhaps less dangerous to be able to be able to add it to a specific container on the page, without using an iframe.

How would it work with targeting the id? Is it possible to specify the id when adding an element to a page using the App Builder?

Not yet but that’s the goal yes.