【问题标题】:click item in JQuery listview wont download在 JQuery 列表视图中单击项目不会下载
【发布时间】:2014-03-01 09:27:08
【问题描述】:

我正在使用 Jquery mobile listview 重新设计一个普通的 html 页面

但是,当我单击新列表中的项目时,其目标在浏览器中作为空白页面打开,而不是像以前那样下载,如果我在加载的页面上按显示源,我会看到文件的数据内容.

我需要它至少将浏览器 URL 设置为文件的 url,这样我就可以从我正在开发的 iOS 应用程序中下载它,我在其中覆盖在 UIWebView 中加载页面。而是将当前 url 传递给下载和解析过程。

我的 HTML 如下所示:

<html>
<font color="LightGray">
<body background="keynote_background.jpg" link="#C0C0C0" vlink="#808080">
<div data-role="page" id="homepage" style="background: #000000 url('keynote_background.jpg') repeat;">
<h1>Work Archives:</h1>
<ul data-role="listview">
<li><a href="http://users.student.lth.se/XXXXX/apps/workout/Extreme.wrk" type="application/work"  download="Extreme.wrk">ExtremeWork</a></li>
<li>Send work to XXXXX@gmail.com to get published here...</li>
</ul>
</div>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js">
</script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js">
</script>
</body>
</font>
</html>

我的 Objective-C 下载例程:

- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request
 navigationType:(UIWebViewNavigationType)navigationType {

    NSURL* url = [[NSURL alloc] initWithString:[[request URL] absoluteString]];
    [DELEGATE loadFile:url];
    if (loadedNowDownloadMode) {
        [SVProgressHUD showSuccessWithStatus:@"Work Updated!"];
    }
    return !loadedNowDownloadMode;
}

如何使用 jquery mobile 的 listview 样式但保持普通 HTML 锚的行为,我想这是最简单的方法?

【问题讨论】:

    标签: javascript jquery ios objective-c jquery-mobile


    【解决方案1】:

    Jquery 错误地假定链接是一个 ajax 页面加载。添加下面的属性是解决方案:&lt;a href="yourfile.zip" data-ajax="false"&gt;Link&lt;/a&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多