javascript button click casuing Internet Explorer secuirty exception
I have a application that allows a user to choose some parameters for a powerpoint report, run the report, then allow the user to "save" or "open" the powerpoint file. I got all of that working OK. When you click on "run" report, it 开发者_如何学Gopops open a window which generates the report, stores it in session, then closes the window. I have a button on the main page that will export the report.
So, now, when the pop up window that generates the report is finished, i use "window.opener" to call a javascript method on the main page, that will do a javascript click of the button. when this button is pressed, Internet Explorer gives me the following message : "To help protect your security, Internet Explorer blocked this site from downloading files to your computer.."
Do you guys know of any tricks around this?
The browser doesn't like it when you try to make a download happen from some context other than a user-triggered event (like a "click"; maybe only a "click"). The user can adjust the security setting, but obviously that's not a solution for most people.
Really the only thing I know to do is to re-think the way that users interact with your pages, so that you can make sure that only actions invoked directly from button clicks (like, URLs that are the targets of form submits, for example) return a download. It's a pain.
精彩评论