Is there anyway to run JS on the client side without modifying the frontend application?
I would like to do some basic things (such as add keyboard shortcuts or inject some css) that seemingly could done using short corredor scripts.
Is there anyway to run JS on the client side without modifying the frontend application?
I would like to do some basic things (such as add keyboard shortcuts or inject some css) that seemingly could done using short corredor scripts.
This is officially not supported, however I found a hack that can make this work!
Apparently metric components inject javascript onto the page every time they refresh.
Here are the steps to get JS to run on page load.
count
(()=>{
if(!window.unlikelyPrefiCustomCortezaJS){
const onLoad = ()=>{
console.log('This will be loaded once per page, on metric refresh, which happens automatically on page load')
}
window.unlikelyPrefiCustomCortezaJS=onLoad;
window.unlikelyPrefiCustomCortezaJS();
}})()
Change the console.log
code to whatever custom JS you want to run on page load.
Note, if you use the “hidden” configuration option on the metric component, the JS won’t run. Tested in 2023.3.3