前提:cordova为5.3.3版本
在config.xml中指定
<content src="http://www.xxx.com/mobile/" />
这样的远程地址,首页打开无问题,
但是后续的链接,点击后,会在外部的浏览器中打开。
当然,如果你用jquery mobile所有网页都通过ajax方式读取,是没问题的。
但是,有些链接是用data-ajax=false的,即直接打开网页。
开始以为是jquery mobile的问题,但把它的js去掉,依然如此。
开始认为是cordova框架内部的问题。
研究半天,下断点,在CordovaWebViewImpl.class中发现:
@Override
public boolean onNavigationAttempt(String url) {
// Give plugins the chance to handle the url
if (pluginManager.onOverrideUrlLoading(url)) {
return true;
} else if (pluginManager.shouldAllowNavigation(url)) { </