0
我正在开发safari扩展,并希望在我的网站上发布扩展。我使用下面的代码,使用户能够下载.safarixtz文件,然后安装: -通过网络服务器提供的Safari扩展
<%String filename = "<safariextz file path>" ;
response.setContentType("application/octet-stream safariextz");
String disHeader = "Attachment;filename=test-safari.safariextz";
response.setHeader("Content-Disposition", disHeader);
// transfer the file byte-by-byte to the response object
File fileToDownload = new File(filename);
response.setContentLength((int) fileToDownload.length());
FileInputStream fileInputStream = new FileInputStream(fileToDownload);
int i = 0;
while ((i = fileInputStream.read()) != -1) {
out.write(i);
}
fileInputStream.close();%>
但生成的文件不能在Safari浏览器和投掷错误安装: -
Safari浏览器无法安装此扩展程序 安装此扩展程序时发生错误
我也希望安装开始的时刻用户点击安装链接就像在苹果画廊。
谢谢
你使用什么语言/平台为你的Web服务器? –
这可能是因为您的下载代码没有正确下载所有字节。你有没有试过比较校验和? – dimitrirostavo
语言看起来像[JSP](http://www.tutorialspoint.com/jsp/jsp_syntax.htm)@StevenSchobert – MauroPerez