Rectangle 27 10

No, it is not possible by design. Chrome packaged apps run separately from the browser and have no access to browser-specific features, like tabs. The closest you can get is to open an external (not in the packaged app) URL in the browser through window.open.

However, you can kind of emulate a browser by using the webview tag. See the code of the Browser sample to learn how to do it.

You can also install an extension that talks to your packaged app using the just released messaging API. See the messaging sample to learn how - it is pretty simple as long as you know the app and the extension IDs.

Thanks! I thought it was impossible, but hoped there was a workaround.

This answer is incorrect. window.open can be used from the background page to allow a packaged app to open in a browser window.

No, it is not incorrect. Packaged apps content cannot open on browser windows. You can open a regular URL using window.open, as I mentioned in my response, but you CANNOT open your app's local content in a browser window unless you use a webview. Maybe you are thinking about the old, deprecated, package apps? (those ran on tabs, not on separate windows)

Well regardless of whether this is recommended or documented, it does work, and is indeed used by a very popular app: chrome.google.com/webstore/detail/videostream-for-google-ch/ (they needed to run in a browser tab so that they could interoperate with the google cast extension, which surfaces no API to the chrome platform, so it makes sense that they would need to run in a tab)

javascript - Run Chrome Packaged apps inside of browser tab - Stack Ov...

javascript google-chrome google-chrome-app
Rectangle 27 0

Take reference from this link. I have used this plugin for my IOS application development way back. It works like a charm. Also, it is easy to integrate.

The link you'd used is dead.

iphone - Phonegap App : External URL don't open in InApp Browser of IO...

iphone ios xcode cordova inappbrowser
Rectangle 27 0

Simple window.open('http://www.google.com') should work and if you want to open the web page in a browser instance within your app, you should consider using InAppBrowser Plugin which uses same window.open and degrade gracefully to default

I want to open it in external browser.window.open open the URL in app itself..right?

thanks for the info... Actually it was the issue with version of cordova..I have changed it and now window.open works.

cordova-1.8.0rc1.js
cordova-2.7.0.js

extjs - How can I open a URL in external browser using Phonegap+cordov...

cordova extjs sencha-touch-2 sencha-touch-2.1
Rectangle 27 0

For me, window.open() didn't work in all cases. Another solution is assign the URL to window.location. Example for opening an external Url using a button:

Ext.Button.create({
            xtype: 'button',
            text: 'open url',       
            handler: function () {  
        window.location = "http://www.google.com";
            });

extjs - How can I open a URL in external browser using Phonegap+cordov...

cordova extjs sencha-touch-2 sencha-touch-2.1
Rectangle 27 0

This question is now a little old, but I felt it was worth updating. This now works fine with PhoneGap Build when used with 2.9.0.

I have compiled and tested it on Android 4.3 and iOS 6.1.3. I do not have the InAppBrowser plugin in my app as that's to open pages in the app, rather than cause the native browser to open them, and I only have the following for the access tags:

<access origin="http://127.0.0.1*"/>
<access origin="http://phonegap.com" subdomains="true" />

cordova - PhoneGap Build: how to open external url in device browser o...

android cordova phonegap-build
Rectangle 27 0

No, it is not possible by design. Chrome packaged apps run separately from the browser and have no access to browser-specific features, like tabs. The closest you can get is to open an external (not in the packaged app) URL in the browser through window.open.

However, you can kind of emulate a browser by using the webview tag. See the code of the Browser sample to learn how to do it.

You can also install an extension that talks to your packaged app using the just released messaging API. See the messaging sample to learn how - it is pretty simple as long as you know the app and the extension IDs.

Thanks! I thought it was impossible, but hoped there was a workaround.

This answer is incorrect. window.open can be used from the background page to allow a packaged app to open in a browser window.

No, it is not incorrect. Packaged apps content cannot open on browser windows. You can open a regular URL using window.open, as I mentioned in my response, but you CANNOT open your app's local content in a browser window unless you use a webview. Maybe you are thinking about the old, deprecated, package apps? (those ran on tabs, not on separate windows)

javascript - Run Chrome Packaged apps inside of browser tab - Stack Ov...

javascript google-chrome google-chrome-app
Rectangle 27 0

It's not the answer when you want to keep using PhoneGap Build, but I solved the problem by setting up a development environment for Cordova (PhoneGap) on my machine and compiling the app locally. In Cordova 2.5.0 window.open('http://www.myurl.nl', '_system'); works perfect, it will open the link in the system's browser.

Can you exaplain what could be the difference from local compile and phonegap build ?

Mostly the difference is in the settings. When you compile locally, it's easier to change certain settings. But because Cordova 2.5 on PhoneGap Build doesn't yield the same results as when installed locally, there must be some difference in the core code, but have no idea why.

cordova - PhoneGap Build: how to open external url in device browser o...

android cordova phonegap-build
Rectangle 27 0

window.open('http://www.myurl.nl', '_blank', 'location=yes');

Why did you vote down this comment ? If you check on phonegap website, this command line is a c/p of InAppBrowser install guide... github.com/apache/cordova-plugin-inappbrowser/blob/dev/doc/ Your profil should be voted down too

You should have mentioned your solution requires the InAppBrowser plugin to work. Otherwise it will not.

Thanks for the tip 'location=yes'. I saw elsewhere it was =no and i couldn't get it to work.

Answer is backwards... Passing _blank explicitly instructs Cordova NOT to open it in the system browser!

cordova - PhoneGap Build: how to open external url in device browser o...

android cordova phonegap-build
Rectangle 27 0

@George Siggouroglou: It's not a good idea to use an id for elements that eventually will appear more than one time in a document. Instead its good practice to make the code more modular.

if expecting touch devices its also a good choice to use "tap" before "click" because it fires much faster and earlier than a click. to check touch capable stuff i prefer to use modernizr because it makes feature detection a breeze.

The jQuery Mobile tap event triggers after a quick, complete touch event that occurs on a single target object. It is the gesture equivalent of a standard click event that is triggered on the release state of the touch gesture. https://api.jquerymobile.com/tap/

hope that helps someone

**html code:**

<a class="ext-link" href="#">Google it</a>
<button class="ext-link" href="#">Google it</button>
//define tab or click event type on rool level (can be combined with modernizr)
iaEvent = "click";
if (typeof navigator !== "undefined" && navigator.app) {
   iaEvent = "tap";
}
$('.ext-link').each.bind(iaEvent, function() {
    if (typeof navigator !== "undefined" && navigator.app) {
        // Mobile device.
        var linktarget = this.attr("href");
        navigator.app.loadUrl(linktarget, {openExternal: true});
    } else {
        // Possible web browser
        window.open(linktarget, "_blank");
    }
});

cordova - PhoneGap Build: how to open external url in device browser o...

android cordova phonegap-build
Rectangle 27 0

webView.setWebViewClient(new WebViewClient(){

@Override
public boolean shouldOverrideUrlLoading(WebView view, String url){
  if(url.equals("http:\\your.url")
      view.loadUrl(url);
  else
  // Do something here to open link in google chrome or some external browser
  return true;
}
});

android - Click hyperlink on WebView launch other browser app - Stack ...

android webview
Rectangle 27 0

<a id="ext-link" href="#">Google it</a>
<button id="ext-link" href="#">Google it</button>
$("#ext-link").on("click"), function() {
    if (typeof navigator !== "undefined" && navigator.app) {
        // Mobile device.
        navigator.app.loadUrl('http://www.google.com/', {openExternal: true});
    } else {
        // Possible web browser
        window.open("http://www.google.com/", "_blank");
    }
});

cordova - PhoneGap Build: how to open external url in device browser o...

android cordova phonegap-build
Rectangle 27 0

Javascript:
myURL = encodeURI(myURL);
window.open(myURL, '_blank', 'location=yes');

Using of encodeURI method fix the above issue

iphone - Phonegap App : External URL don't open in InApp Browser of IO...

iphone ios xcode cordova inappbrowser
Rectangle 27 0

Let answer,but may be it can help someone.

navigator.app.loadUrl('https://google.com/', { openExternal:true });

This was quite buggy for me, my app would load multiple tabs even though the link was only clicked once!

Me too, I ended up using Hammer JS to listen for tap events, this prevented the link from being opening multiple times.

Buggy for me on Android. The link opened in the browser but then the app came back into focus.

cordova - PhoneGap Build: how to open external url in device browser o...

android cordova phonegap-build
Rectangle 27 0

3.B.6. Native Browser Clicks In order to do tracking in the OSs native browser, partners may choose to use the native browser click functionality supported by the MoPub SDK.

You can target this functionality via the banner.ext.nativebrowserclick field on the request. If set to 1 it is supported by the requesting SDK.

In the creative returned in the adm field, this behavior can be triggered by setting the click through URL in the following format using a custom URI pattern (this custom URI will open the URL in the native OS browser) :

IMPORTANT: Ensure that http:// or https:// is included in the intended landing page URL.

Open URL (In IOS app) form Mopub Order in external browser - Stack Ove...

ios browser external mopub
Rectangle 27 0

There are 2 things you are doing wrong: 1) you create a new WebView but never attach it to your view tree and 2) you ask an outside app to handle the viewing of the url you want to display. You need to either add the WebView to your xml layout file or attach to the view tree by using view.addChild(web); on your root view. Once the WebView is part of your view tree just call web.loadUrl(...); to load the web page. Since you don't want to open the web page on an external browser, you should just get rid of your Intent it =... and startActivity(it);.

If you want to open the web page on a different activity, just create a new activity with a webview in its layout. You can find an example on how to do it here.

android - How to open a URL with specific settings? - Stack Overflow

android android-intent android-webview android-websettings