How do I set the origin of my notebook url?

Hello,

I am trying to set up notebooks for an internal use case of our team. The notebook is linked to url [abc | pqr | com] and it is added as an iframe on page def | pqr | com

I want to detect user clicks on the iframe. I came across this stackoverflow question
https://stackoverflow.com/questions/23362842/access-control-allow-origin-not-working-for-iframe-withing-the-same-domain

So I need to set document.domain = ‘pqr . com’ on page def.pqr.com and abc . pqr . com. The abc page is coming directly from spinning up a notebook. So it looks like I need a way to add “document.domain = pqr . com” somewhere in the process of spinning up a notebook.

I was hoping I can do this through the jupyter_notebook_config.py file OR through some other external way without having to mess with the core notebook repo.

Does anyone have ideas or previous experience with trying to achieve this?

Thank you!!!

Looks like I can use custom.js to set this.

https://jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/JavaScript%20Notebook%20Extensions.html

But I am unable to add custom.js to the notebook in my docker container.

Has anyone tried using custom.js before? How did you add it to the docker container?