Inappbrowser links opening new browser instince how?

  • 1
  • Question
  • Updated 4 years ago
  • (Edited)
I would like to use an inappbrowser to open my webpage and use the ui and functions already set up there in wordpress. I would like to have external links exit my app and open in the devices defualt browser.

https://github.com/pommiegranit/wp-ba...
The app I am starting from.
Photo of Jon Sellers

Jon Sellers

  • 8 Posts
  • 0 Reply Likes
  • hopeful

Posted 4 years ago

  • 1
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
Hi Jon,
Since this is your first post, please answer the following question:
- is this your first hybrid app?
- are you using Desktop App?
- are you using CLI, Build, or SDK? Please do not assume the answer, please read the link.

Thanks
Jesse
Photo of Jon Sellers

Jon Sellers

  • 8 Posts
  • 0 Reply Likes
First hybrid app, yes.
Desktop App? No, I don't think so. I am using notepad++ and windows to edit, github and build.phonegap.com to build, Gennymotion and local devices to test.
And the template app I am using's config.xml has a tag which says: preferences phonegap-version 3.3.0

Still a little hazy on the differences between phone gaps.
Read the link once, bookmarked for further examination ty.
It doesn't explain how I can tell wether I'm using CLI, build, or SDK.

I know "Google and Apple frowns on using apps as wrappers for websites." still.

I have been working on this for a few days now. I should've asked for help sooner
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
It doesn't explain how I can tell wether I'm using CLI, build, or SDK.
The FAQ #1 does does not explain the difference. There are no real documents to explain the difference. I may write one one-day, except working Corodova/Phonegap is a moving target.

More below.
Photo of Jon Sellers

Jon Sellers

  • 8 Posts
  • 0 Reply Likes
I have Android Studio and XDK but have not used them for this project yet.
I am not familiar with executing from the command line but I can.
If building this thing in AS or XDK is what I have to do to make external links open a new browser then its probably not worth it for me.

On my website I can minimize the use of external links and add a fancy goodbye notification.

Still. If I can add some lines of java and from then on target any links out, that would be awesome!
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Jon
okay. your thinking is way off. In short, Phonegap have four (4) components.

- HTML creates the structure of the visual.
- CSS defines the visual items; color, fonts, buttons, area (like forms) sizes, and any thing visual.
- Javascript is your control language.
- Plugins (via config.xml) add extensions on everything from hardware on the device, to communications with third-party servers.

You can also use javascript libraries to talk to HTML5-API services or MBaaS (Mobile Backend As A Service) Providers.

If you are writing Java for any reason other than a plugin, you are wasting your time.

Mobile development has a ton of warts, but that is because there are so many devices to deal with.

You should read the bold sentences in the FAQ I pointed you two earlier. Here it is:

Top Mistakes by Developers new to Cordova/Phonegap

Next read this tutorial, this will give you a better idea of what you have to do.
An HTML Boilerplate for Phonegap

The code is dated, but it works -- not sure how much longer, but tonight it works. The differences in the new version are minor, but enough to trip those that don't know.

Finally, the biggest difference between CLI, Build and SDK is that the workflow differs. They all use the same code base, but the directory structure differs. They all use the same plugins, but the workflow differs.

Read what you can. If you don't understand, say so. I or someone else will help get you onboard. Documentation is here; don't use others (see FAQ) - except for plugins (use plugin docs). If you have a questions on the docs, ask.

As for your original question, you need to add the whitelist plugin - especially if you are using the latest Android devices. AND get rid of the code base you are using as an example. IT IS WAY TOO OLD. For Build, default is cli-5.2.0; leading edge is cli-6.0.0. Cordova (the mother project) is cli-6.1.1 BLOG

Questions?
Jesse
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
@Jesse - what would, in this case, the whitelist plugin be needed for? OP wants the external content in the system browser, coming from the inappbrowser window.

@Jon - the code you posted in the other thread ( http://community.phonegap.com/nitobi/... ... imho, you were spot on there, so I'm not sure why Jesse sent you away) looks pretty good. I haven't attempted to test or debug it, but at first glance, I understand the concept and the solution, using localStorage for the transfer of the hyperlinks.

Do you have any specific questions about that code? Do you receive error messages or does the code fail somewhere?
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Petra,
I'm sure we covered this subject and I blogged it. I'm searching my blogs now.

Adding to the previous thread gains nothing. Your fascination with doing that is a source of discussion for another time.

Jesse
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
My notes say to open the system browser via the inappbrowser requires <allow-intent>, which is part of the whitelist system. I have tests from dec of 2015 we can run again - if need be.

Jesse
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Are you sure this was related to the inappbrowser plugin with the _system target parameter? I thought that was about the _self parameter or even just for ordinary hyperlinks in the webview.

From the inappbrowser docs:
The InAppBrowser is not subject to the whitelist, nor is opening links in the system browser..
https://www.npmjs.com/package/cordova...
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
The part you are quoting is in a tutorial I have somewhere. I need to find it. The documentation is in conflict. I have reported it, but unfortunately it is being ignored.
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
Here are my notes on InAppBrowser and Whitelist
How does this affect inappbrowser?

From the Whitelist Matrix Worksheet

Jesse
Photo of Jon Sellers

Jon Sellers

  • 8 Posts
  • 0 Reply Likes
@Petra,
You have given me hope.
I will try to implement the workaround as I mentioned it in the other thread, push it to git, build it, test it and get back to you in the morning, perhaps let you see it. Ty.

@Jesse,
Yes, why not use the oldest possible working app build?
The above "WAY TOO OLD" app builds quick, is small and fires fine on every device I can get my hands on or emulate in Genny. "If it ain't broke..." No?

The only drawback with this "OLD" app I can find so-far is the retarded older kitkat default android browsers (now almost extinct) which I can target in website from webview with an "upgrade your default browser" message.

You should know. I did at one point build the app with cli-5.2.0 and the crosswalk plugin trying to fix the older kitkat issue (not worth loosing out on win and apple phones btw). That took forever and unlike this "OLD" app it didn't work in any device, probably because of a depreciated command line tag, who would do that? Its like pulling a rug out from underneath someone.

NE Ways.
Thanks
And both of you thanks for being here. This is awesome, better support than Adobe and Microsoft put together.
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
@Jon,
About "way too old": Jesse is right. You can't use preferences phonegap-version 3.3.0 anymore.

With PGB3.5.0, a security issue was solved. Google refused to accept older apps anymore, more than a year ago already.

Nowadays (in fact since this week), Google won't accept an app built with anything less than PGB 'cli-5.2.0' anymore.
http://community.phonegap.com/nitobi/...

And to make things worse, Apple issued a message saying that security issues would force you to use PGB cli-6.x now.
http://cordova.apache.org/announcemen...

You should update!
Photo of Jon Sellers

Jon Sellers

  • 8 Posts
  • 0 Reply Likes
@Petra, that's pretty convincing.
I have a lot to read.
I probably won't be pushing building or testing in the morning after all.
Thanks.
Photo of Jon Sellers

Jon Sellers

  • 8 Posts
  • 0 Reply Likes
@Jess I have been reading through the documentation and followed a more info here link to http://phonegap.com/blog/2012/03/20/a... concerning whitelisting, I am concerned about the date of the article. Is this still accurate?
"If you want a link to open in the device’s browser (using PhoneGap 1.5.0):
on Android, don’t list the domain in the whitelist
on iOS, list the domain in the whitelist, and then use target=”_blank” ."

Meaning, website webview apps handle external links differently in different devices despite the white list or the target?
Photo of Jon Sellers

Jon Sellers

  • 8 Posts
  • 0 Reply Likes
Photo of JesseMonroy650 (Volunteer)

JesseMonroy650 (Volunteer), Champion

  • 3325 Posts
  • 122 Reply Likes
@Jon,
the blog post (Access Tags) is too dated to be accurate. It may be correct, but I see lots of read flags, namely blackberry is no longer supported and the "child browser" has been superseded with inappbrowser.

As for how external links are handled, they are all documented in the plugin documentation under "quirks". REMINDER: PGB, at this time, only support Android, iOS and Windows.

FWIW: Your order for reading documentation should be PGB docs, then plugin docs. The blog does carry "some" undocumented (or early documented) features and/or parameters, but the blog posts should mostly be used to stay abreast of the current situation. In extreme cases, a member of the PGB team will come on the forum for a few days to clear things up.

Hope this helps
Jesse