我有一个 jsp 文件,根据其当前功能,它在应用程序的同一窗口中打开附件。我希望它在新窗口中打开附件,即使它是一个弹出窗口。
我尝试使用“window.open”功能,但出现括号错误。主要问题是我不想丢失现有映射,因此我不会从头开始编写语句。
<a
href="<%=UrlBuilder.getServletRoot()+"ProgramAttachmentRetriveServletactionId=retrieve
&attachmentType=I"%>
&attachmentId=<%=attachmentInt.getAttachmentId()+"&programSysId="%>
<%=request.getParameter("programSysId")%>">
<%=attachmentInt.getAttachmentDesc()%>
</a>
如您所见,我正在通过超链接打开附件。我希望它在一个单独的窗口中打开。我怎样才能使用'window.open'来做到这一点。如果无法通过此功能打开它,我还能如何打开它?
最佳答案
这个问题的答案实际上很简单,而不是改变很多行,我可以直接使用 'target="_blank"' 作为 href 标签。 '_blank' 属性使附件在新窗口中打开。
关于javascript - 使用 window.open 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57371265/