Can already embed Jupyter Server. How to open Notebook within the same IFrame

Our company embeds the jupyter notebook server within an iframe. I’m able to embed it like this:

But when the user clicks on an actual notebook link, it opens up in a new tab in the browser completely escaping the iframe. How can I make it stay within the same IFrame?

Also, if there are any Zero To JupyterHub Kubernetes specific config as well, please let me know. Thanks!


How can I make it open in the same IFrame itself? A

I’m able to get it working using the custom.js solution as suggested here. But it’s very inconsistent. Sometimes it opens up in the same iframe and sometimes it opens up in a new tab :(. If someone could help me, I would truly appreciate it.