I have a website in which I am using my chat website as in iframe as follows,
<iframe id="chat-iframe" src="https://chat/livechat" style="width: 100%; height: 100%; border: none; background-color: transparent; display: initial;"></iframe>
I have a download file button inside the iframe as follows,
<a target="_blank" rel="noopener noreferrer" class="file-attachment__inner__mQCxr" style="cursor:pointer" href="https://chat.com/file-upload/4aNPtgsok63sfdMLr/YN_Hotel_F07-010-F6F9%20(2)%20(1)%20(9)%20(27)%20(11).pdf')">
When I click on the anchor tag, it is opening the pdf in the same window of iframe instead of downloading. Can anyoneplease hlep me out sorting it. Thanks.
I even added tried downloading via JS code but still opening in the same tab,
function onClickFileDownload(link) {
const anchor = document.createElement("a");
anchor.href = link;
anchor.download = 'test';
anchor.target = '_blank';
document.body.appendChild(anchor);
anchor.click();
document.body.removeChild(anchor);
}