开发者

Get File Download dialog instead of loading page

I have the following code, which launches a coldfusion page in 开发者_开发知识库a new window

$(".productDetailLink").click(function(e) {
    var listings_clickedId = $(this).attr("id")
    var product_id = listings_clickedId.split("^")[1]
    openWindow("/popupDetail.cfm?entity=products&product_id=" + product_id,"detail","width=900,height=600,left=200,top=50,scrollbars=yes");
})

I'm pretty sure it wasn't doing this before but instead of opening the page, it launches a file download dialog box, asking me if I want to download the page, instead of just launching the page.

Any help greatly appreciated.

function openWindow(url,windowName,winatts){
        var windowName = windowName || 'NewWindow';
        var winatts = winatts || 'width=800,height=600,left=200,top=50,scrollbars=yes';
        window.open(url,windowName,winatts);
    }


Do you have access to the cold fusion code? Am I understanding you correctly that you want a download box to show?

If you have access to the ColdFusion server and can modify the response headers to send something like:

Content-Disposition: attachment; filename=fileName.ext

It should prompt for a download box.


function openWindow(url,windowName,winatts){
        var windowName = windowName || 'NewWindow';
        var winatts = winatts || '_blank,width=800,height=600,left=200,top=50,scrollbars=yes';
        window.open(url,windowName,winatts);
    }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜