我刚刚升级到PhoneGap 1.6.1,我无法再在Safari中打开外部URL.
在此版本之前,我修改了AppDelegate.m,如下所示:
- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
{
NSURL *url = [request URL];
if ([[url scheme] isEqualToString:@"http"]) {
[[UIApplication sharedApplication] openURL:url];
return NO;
} else {
return [self.viewController webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
}
}
Run Code Online (Sandbox Code Playgroud)
我注意到之前有一个类似的问题: 如何在Safari中打开外部链接而不是应用程序的UIWebView?
但在我看来,这个答案不再适用于1.6.1版本.
我也尝试在Cordova.plist中设置OpenAllWhitelistURLsInWebView,但两个设置都没有给我Safari.
提前致谢.
我一直在努力寻找一种方法来更改标题中的按钮而不会丢失格式.我想将带有删除图标的删除按钮更改为带有复选图标的完成按钮.
这是代码的缩短版本:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
<script type="text/javascript">
function swapButton() {
$('#button').attr('data-icon', 'check').text('Done').trigger('create');
$('#header').trigger('create');
}
</script>
</head>
<body>
<div data-role="page">
<div data-role="header" data-position="fixed" id="header">
<a data-icon="delete" id="button" onclick="swapButton()">Delete</a>
<h1>Test Page</h1>
</div>
<div data-role="content">
<p>Click on Delete to get Done button</p>
</div>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这会正确更改按钮的文本,但所有格式都会消失.
我已经尝试使用trigger('create')按钮和标题不起作用,我也尝试过.page()我在其他地方读到的方法,我也试过了.button().
我想不出别的想法.
我的具体问题是我正在尝试在JQuery Mobile中实现它:
http://www.rwe-uk.com/blog/comments/ichat_like_speech_bubbles_with_css_3
发生的事情是,我可以看到页面看起来完美了大约半秒钟,然后JQuery Mobile将它全部变为灰色.
我想更普遍的问题是如何让JQuery Mobile单独留下一部分页面?
我已经在Google上搜索了很多,我已经看到了使用Themeroller的建议,但我看不出如何使用它来设置这些特定的样式.
我也尝试过使用data-role ="none",但这似乎只适用于表单元素.
编辑:
这是代码:
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
<link rel="stylesheet" href="http://www.rwe-uk.com/static/ichat_with_css3/style_5.css" />
</head>
<body>
<div data-role="page">
<div class="commentArea">
<div class="bubbledLeft">
Hi
</div>
<div class="bubbledRight">
Hi there yourself
</div>
</div>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
如果我删除jQuery Mobile脚本行,它可以正常工作.