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