When I use window.open to open a site which redirects to my site, it results in only showing the background color of the body but without any visible content. The content loads but it’s not visible until I resize the page.
<button>Click</button>
document.querySelector('button').addEventListener('click', function() {
window.open('https://dashboard.palatial.cloud/project/663cdb4789db9b22c12cff23/share', '_blank');
});
But this code using <a>
works fine:
document.querySelector('button').addEventListener('click', function() {
const a = document.createElement('a');
a.href = 'https://dashboard.palatial.cloud/project/663cdb4789db9b22c12cff23/share';
a.target = '_blank';
a.click();
});
What is the difference between both approaches? I’m not able to change how the user is being directed to my site, so what would be a way to fix this on my side?
1