最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - InAppbrowser window.open plugin for Cordova 3.5 not working - Stack Overflow

programmeradmin2浏览0评论

InAppBrowser's method .open() not working in my app. Using Cordova 3.5 and plugin's version 0.4.1 from InAppBrowser plugin.

Tried the given example:

var ref = window.open('', '_blank', 'location=yes');

But doesn't work.

If I build the app with cordova run android the app is installed into my device and nothing happens when I click the link with the onclick calling the above code. Same with cordova serve and accessing through localhost:8000 (local browser).

If I emulate through ripple (with ripple emulate), when I access the page (localhost:4400/) and click at the link, the page is reloaded with the content: "InAppBrowser Emulation It is like a browser, only it is all up in your app

URL: /
TARGET: _blank
OPTIONS: "location=yes"

Anyone have any idea?

InAppBrowser's method .open() not working in my app. Using Cordova 3.5 and plugin's version 0.4.1 from InAppBrowser plugin.

Tried the given example:

var ref = window.open('http://apache', '_blank', 'location=yes');

But doesn't work.

If I build the app with cordova run android the app is installed into my device and nothing happens when I click the link with the onclick calling the above code. Same with cordova serve and accessing through localhost:8000 (local browser).

If I emulate through ripple (with ripple emulate), when I access the page (localhost:4400/) and click at the link, the page is reloaded with the content: "InAppBrowser Emulation It is like a browser, only it is all up in your app

URL: http://apache/
TARGET: _blank
OPTIONS: "location=yes"

Anyone have any idea?

Share Improve this question edited Jun 10, 2014 at 19:01 Christian Benseler asked Jun 6, 2014 at 16:20 Christian BenselerChristian Benseler 8,0759 gold badges42 silver badges73 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 2

Update:

We were getting different results when the project was built on different machines. We found that the issue was caused by an untracked file:

[cordova project folder]/plugins/android.json (or other OS : ios.json)

We found each machine had a different plugin order. When we started tracking the file and fixed the plugin order then the problem went away. You may want to remove the plugin on all machines then add it again.

I'm not sure why the order matters, you would think it shouldn't but it does.

Adding the file, syncing repositories and rebuilding fixed the issue.

Try using _system instead of _blank.

Original:

Also, for iOS I had to use something like this:

 <a onclick="window.open('http://google.ca', '_system')" >iOS</a>

But on Android I had to use :

<a onclick="navigator.app.loadUrl('http://google.', {openExternal : true})" >Android</a>

I also have the same problem, I found the solution:

    var ref=window.open(encodeURI(url), '_blank', 'location=no,closebuttoncaption=Main');
    ref.addEventListener('exit', function()

Use this code to open the url.It will work

I had the same problem and I "fixed" it by calling the Cordova function directly:

cordova.exec(successFunction, errorFunction, "InAppBrowser", "open", ['http://apache', '_blank', 'location=yes']);

Hopefully that works for you.

发布评论

评论列表(0)

  1. 暂无评论