Я хочу показать pdf при нажатии кнопки предварительного просмотра, но pdf блокируется при открытии в новой вкладке. Итак, я хочу обойти свойство блокировщика всплывающих окон браузеров
getPdf(projectId) {
this.http.get(environment.apiUrl + "/poject/getPdf/" + projectId + '/' + this.userDataSession.userDetailsId + '/' + 8 + '/' + this.authService.getUserToken(), { responseType: 'blob' })
.subscribe((blob: Blob) => {
let url = URL.createObjectURL(blob);
let link = document.createElement("a");
if (link.download !== undefined) {
let url = URL.createObjectURL(blob);
let win = window.open(url, '_blank');
win.focus();
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
});
}
Вот так я получаю доступ к pdf с сервера и хочу показать в новом окне, но браузер блокирует всплывающее окно