开发者

Ext JS: AJAX response opens new browser tab

开发者 https://www.devze.com 2023-01-05 14:45 出处:网络
How can I make an AJAX request using Ext JS and have the re开发者_如何转开发sponse (a PDF file) load into a new browser tab (or window)?I would not use an AJAX request for this, as you\'re not updatin

How can I make an AJAX request using Ext JS and have the re开发者_如何转开发sponse (a PDF file) load into a new browser tab (or window)?


I would not use an AJAX request for this, as you're not updating the page they're currently on in any way. I'd just have a direct, normal link to the PDF generation URL.


// Create an IFRAME.
var iframe = document.createElement("iframe");

// Point the IFRAME to GenerateFile, with the desired attributes as arguments.
iframe.src = 'something.html';

// This makes the IFRAME invisible to the user.
iframe.style.display = 'none';

// Add the IFRAME to the page.  This will trigger a request to URL.
document.body.appendChild(iframe);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号