我想通过与IE的开放链接保存文件,但问题是IE推行动作,我在Firefox中找到了一种方式打开链接view-source:
这将打开下载文件在浏览器中作为二进制文本,当我可以直接保存此文本并将扩展名重命名为zip。
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = 0
url = "view-source:http://mysite/stockquote/NASDAQ/AAPL.zip"
ie.Navigate url
state = 0
Do Until state = 4
DoEvents
state = ie.readyState
Loop
text = ie.Document.Body.innerHTML ' not worked as file is downloaded before this appears, and prompting for action save or open which i want to avoid it
ie.Document.Write "<html><head></head><body><div id=""content""></div><script src=""https://code.jquery.com/jquery-1.12.4.min.js""></script><script>$(document).ready(function(){$.ajax({url: '" & url & "',type: 'get',success: function(data){$('#content').html(data); }});});</script></body></html>" ' also not work as ajax do not load urk contens
1.那么如何导航到view-source:在IE中就像在Firefox中一样? 用于搜索窗口的Sendkeys,XmlHttp和api函数不适合我,因为我需要使用Csrf令牌进行身份验证并且在不使用IE窗口的情况下使用everithing visible = False。 2.如何在不提示的情况下使用javascript或ajax下载zip文件