【发布时间】:2013-03-17 21:56:19
【问题描述】:
我对使用 Google 搜索有疑问。 我可以在我的原生 iOS 应用程序中使用自定义谷歌搜索,而不是使用他们的 api 工具,这对谷歌来说是个问题吗?
我写html页面(http://barzyczak.vot.pl/search.html?q=test):
<!DOCTYPE html>
<html>
<head>
<title>Element V2: Results Only Layout Demo</title>
<!-- Put the following javascript before the closing </head> tag. -->
<script>
(function() {
var cx = 'xyz';
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
})();
</script>
</head>
<body>
<!-- Place this tag where you want the search results to render -->
<gcse:searchresults-only enableOrderBy="false"></gcse:searchresults-only>
</body>
我确实在我的 iOS 应用程序中请求包含上述内容的站点并收到结果。我在 UIWebView 中显示了这个结果:
我可以用吗
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationTyp
并将用户重定向到我的 UIViewController?这符合 Google 政策吗?
我是否可以拦截/捕获用户对链接的点击并打开本机应用程序视图而不是 webview 或者我应该在 webview 中打开所需的页面,然后使用 iOS 架构 URL 重定向(使用 301 代码),这会打开本机应用程序视图(所以真的模拟谷歌点击)?
附言。 我知道 Google API,但这不适合我。
【问题讨论】:
-
我认为 google 政策与您在应用程序中的导航位置没有任何关系!
-
但是我也可以在搜索结果中浏览 Google 广告吗? :)
-
广告通常是前两个链接,虽然如果你跳过广告,谷歌可能不喜欢它
标签: iphone ios uiwebview google-search