使用jQuery mobile的可下载文件 [英] Downloadable files using jQuery mobile
问题描述
我对jquery mobile还是陌生的,尝试在我的jquery mobile项目中链接文件进行下载时遇到错误.我希望用户能够从应用程序下载.zip文件,但会出现页面加载错误,或者在新页面中显示未定义.我尝试使用锚标记来链接文件以进行下载,但它似乎无法正常工作.我知道jquery mobile使用了anchor标签,所以我不知道是否需要做一些特别的事情.有帮助吗?
I'm fairly new to jquery mobile, and am getting an error when trying to link a file in my jquery mobile project for download. I would like a user to be able to download a .zip file from the app, but get either a page loading error, or undefined displayed in a new page. I tried using an anchor tag to link the file to download, but it doesn't seem to work right. I know jquery mobile makes use of the anchor tag, so I don't know if there is something special that needs to be done. Any help?
推荐答案
当jQuery Mobile假定链接是页面并尝试加载AJAX页面时,您可能会遇到异常.禁用链接上的AJAX加载.
You are likely getting the exception when jQuery Mobile assumes the link is a page and attempts an AJAX page load. Disable AJAX loading on the link.
<a href="yourfile.zip" data-ajax="false">Link</a>
我不知道典型的移动浏览器将如何处理zip文件的链接.
And I have no idea what the typical mobile browser will do with a link to zip file.
这篇关于使用jQuery mobile的可下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!