前端如何打开后端返回html文件链接?-灵析社区

邦纳娜娜

后台返回一个html文件的链接,想要在前端预览查看,使用window.open("链接")打开,但是浏览器直接下载了,并没有打开文件 后台增加Content-Disposition:inline还是打开

阅读量:160

点赞量:0

问AI
再来个"Content-Type: text/html; charset=UTF-8" 把"Content-Disposition"这个头删掉 看看百度(或者其他任意正常网页)返回的是啥就知道了 "image.png" (https://wmprod.oss-cn-shanghai.aliyuncs.com/c/user/20241013/d0936956ee9ef7e08145017366eb0bb9.png)