te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>android won't open google play links from javascript in web-app - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

android won't open google play links from javascript in web-app - Stack Overflow

programmeradmin3浏览0评论

I've got an html app which is wrapped in Phonegap and in the android store.

I'd like to put a link to the app within the app for users to update if an update is available.

According to the documentation, and some results here on SO, on devices,

< a href="market://details?id=.myapp.name" > Update App </a>

opens the store, but I need to open the link from javascript.

I've tried both window.open and window.location.href but both of those open the browser and I get a URL not found error. The url in the browser turns out to be http://market://details...

Anybody know why or how I can link directly to the store, not to the play website?

---------------UPDATE -------------------

I don't want to open the play store in a browser, I am trying to open the native play store.

I know this is possible because smartbanner opens the proper store. .smartbanner/

But I can't get it to work.

I've got an html app which is wrapped in Phonegap and in the android store.

I'd like to put a link to the app within the app for users to update if an update is available.

According to the documentation, and some results here on SO, on devices,

< a href="market://details?id=.myapp.name" > Update App </a>

opens the store, but I need to open the link from javascript.

I've tried both window.open and window.location.href but both of those open the browser and I get a URL not found error. The url in the browser turns out to be http://market://details...

Anybody know why or how I can link directly to the store, not to the play website?

---------------UPDATE -------------------

I don't want to open the play store in a browser, I am trying to open the native play store.

I know this is possible because smartbanner opens the proper store. http://jasny.github.io/jquery.smartbanner/

But I can't get it to work.

Share Improve this question edited May 8, 2013 at 2:22 pedalpete asked May 8, 2013 at 1:34 pedalpetepedalpete 21.5k45 gold badges133 silver badges245 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 9

Turns out that phonegap basically steals the window.open, and was checking the protocol used within. Therefore using '_blank' within phonegap doesn't open a new browser window (as you'd expect) but instead opens a browser window within phonegap, which phonegap owns and only lets use either http or https protocols (I'm assuming those are the only two).

In order to pass a link to the system browser, you have to use

window.open("market://details?=.your.app","_system");

and that will send the request out of phonegap and open the link in the native browser, which then redirects correctly to the native app store.

User target="_top"

 <a href="market://details?id={package_name}" target="_top">App</a>

As Google says here

Use the format below to deep-link users directly to a specific app's product details page. At the product details page, users can see the app description, screenshots, reviews and more, and then install it.

To create the link, you need to know the app's fully qualified package name, which is declared in the app's manifest file. The package name is also visible in the Developer Console.

From a web site: (these will open the dialog of what app you want to take the action: browser or market)

http://play.google./store/apps/details?id=<package_name>  

From an Android app:

market://details?id=<package_name>
发布评论

评论列表(0)

  1. 暂无评论