我正在尝试在新标签页中打开window.open
。新标签基本上是一个PDF文件,会提示用户下载。
这是我的Angular 4代码:
download() {
const data = {html: this.template.toArray()[0].nativeElement.innerHTML};
this.authService.generateResume(this.template.toArray()[0].nativeElement.innerHTML).subscribe(res => {
const path: string = res.success;
const uri = path.substring(path.lastIndexOf('/'), path.length);
window.open('http://example.com/pdf' + uri, '_blank');
})
}
我理解window.open
被视为弹出窗口。
我们如何解决这个问题?
答案 0 :(得分:-3)
要打开新网页,请尝试使用:
位置。取代( “// URL”);