【IT专家】window.open打开弹出而不是窗口
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
本文由我司收集整编,推荐下载,如有疑问,请与我司联系
window.open打开弹出而不是窗口
window.open打开弹出而不是窗口- 行为不一致[英]window.open opens pop up and not window - behavior inconsistent In my javascript code I am using the window.open method and the behavior is totally inconsistent: depending on the way I write the code it will either open a new tab or open a pop up window (which is blocked by the pop up blocker). I don’t know how to work around it thanks for your help. The html code:
在我的javascript代码中,我使用window.open方法并且行为完全不一致:根据我编写代码的方式,它将打开一个新选项卡或打开一个弹出窗口(被弹出窗口阻止程序阻止) 。
由于你的帮助,我不知道如何解决它。
HTML代码:
a target=“_blank” Visualiser /a The javascript code:
javascript代码:
function quoteVisu(){ quoteCreate(1); quoteCreate is a method with an AJAX call
quoteCreate是一个带有AJAX调用的方法
function quoteCreate(num_function){ var request=$.ajax({ url: url_up, type: “POST”, beforeSend: function(xhr) {xhr.setRequestHeader(‘X-CSRF-Token’, $(‘meta[name=“csrf-token”]’).attr(‘content’))}, data: {q_param: { title: title, total: total, list: list, client: idclient, tax_rate: tax_rate success: function(data, textStatus, jqXHR) { if (num_function==1){request.done(goShow(data.quote_id))}; if (num_function==0){request.done(goBack());} dataType: “json”return true; and the goShow method:
和goShow方法:
function goShow(quote_id) { var url_visu=“/visu_pdf/quote_visu.”+quote_id window.open(url_visu, ‘_blank’); return true; The code above gives a pop up window which is not the behavior expected. If I put the window.open in the quoteVisu method for example I will have a tab open and not a pop up which is what I want. But if I put it there I don’t have the answer from the JSON which is needed for the new window url.。