I have to use YouTrack in the company I am working for, and it drives me nuts for several reasons. I am now creating a Chrome Extension which helps me calm down a bit.
One of the absolutely ridiculous things is the fact, that YouTrack opens all Tickets in a new Tab. So one of the functions of my extension is overwriting the link targets. It all works fine except on these stupid widget things:
These are iframes (why tho??) and they block me from accessing it even though they are coming from the same source as the parent. So I have not found a way to get in there and change the link targets via JS / jQuery. Is there something I don’t see?
I already tried removing the sandbox attribute but does not work. Here is how the iframe is loaded:
Any idea how I can access the dom of the iframe? Its all hosted on the same subdomain so theoretically cross-origin should not be a problem….
I obviously don’t have access to the iframe’s source code
function changeLinkTarget() {
$('a').attr('target', '_self');
document.querySelectorAll('iframe').forEach(iframe => {
iframe.removeAttribute("sandbox");
iframe.removeAttribute("allow");
});
$('iframe').contents().find('a').attr('target', '_self');
}
Logging $(iframe).contents()
returns