Phonegap - Open Links in Browser except embedded Videos - iphone

I'm Developing an App using Phonegap, target Devices are Android or iOS driven. My Problem is, that on the iPhone I can only set the "open all whitelist urls in webview" parameter to true or false. So that is the Problem:
Expected Result:
- All links (like www.google.com, www.stackoverflow.com) should open in the Browser
- An embedded iFrame with a Youtube Video should open in the Webview
Result with "OpenAllWhitelistUrlsInWebview" Set to true
- All links and iFrames will open in the Webview
Result with "OpenAllWhitelistUrlsInWebview" Set to false
- No links and iFrames will open in the Webview
How can i specify which links should open in the Browser and which shouldnt? When i remove an url from the whitelist the link won't open at all and also setting target="_blank" wont work properly. Trying it with window.open didn't work either.
Thank you very much for every idea.

Implemented this over the weekend, and it's working great:
http://www.rigelgroupllc.com/blog/2012/05/22/opening-links-in-phonegap-apps-in-mobile-safari/
This will allow you to set up your plist for the youtube video, while using the above method to open specified links in the external browser.
I'm not sure what/if you need to do anything in Android.

Related

Ionic 2 In App Browser - Keep user within app, currently all website links go to Safari

I am wrapping a web app I have built in an Ionic 2 application so the client can release on the app store(s).
I am using:
https://ionicframework.com/docs/native/in-app-browser/
Which correctly loads up my testing IP but any anchor tags open up in the normal Safari browser. How can I keep the user within the in app browser?
This is how I set up the browser:
const browser = this.iab.create('my.ip.add.ress');
browser.show();
I have tried changing the links on my website to use all of the following variations:
target="_blank"
target="_system"
target="_self"
But nothing works.

Embed facebook 360 video in UIWebView

Facebook has launched option to embed 360° video in web app. I am trying show embedded video in UIWebView. But its not working.
Here is my code,
let iStrEmbed = "<iframe src=\"https://www.facebook.com/plugins/video.php?href=https%3A%2F%2Fwww.facebook.com%2Ffacebook%2Fvideos%2F10153231379946729%2F&width=500&show_text=false&height=281&appId\" width=\"500\" height=\"281\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\"></iframe>"
webVW.allowsInlineMediaPlayback = true
webVW.mediaPlaybackRequiresUserAction = false
webVW.loadHTMLString(iStrEmbed, baseURL: nil);
I have noticed its not working in even safari of mobile. Its working fine in all browsers on mac.
Is it supported only for desktop as of now?
As of now, yes- desktop only. I've had the most success on our custom-WordPress productions with the following hack via Facebook for Developers platform. Please try the following steps:
Upon selecting your Facebook360 video or photo, click on the ellipsis menu and select Embed.
Next, a dialogue-window will prompt- click on Advanced Settings.
Clicking the aforementioned will direct you to the Facebook for Developers platform; click here to see the instance created for the subject example.
Click on the Get Code button, which will prompt another dialogue box; then click on the iFrame tab and copy the code.
Copy the code contained within the iFrame tab.
Post and feature on desired section of web-app or website.
Although Facebook assures fellow developers that an easy WordPress integration will be released soon, as of this post, that remains to be seen; hopefully, we will see one soon for the sake of our clients because the solutions provided for the duration (subject example for WP):
<div class="fb-video" data-href="https://www.facebook.com/video.php?v=10152795258318553"
data-width="500" da enter code hereta-allowfullscreen="true"></div>
aren't exactly responsive and sometimes fail to render as expected. Hope that helps!

How do I open any app from my web browser (Chrome) in Android, automatically?

I am struggling a little bit. I have a common url like www.domain.com/test.html
and i want Android users to get my app open if "test" is included, otherwise if they don't have the app their should be directed to the play store. I got everything implemented and it works with mozilla browser. But using chrome on Android it should be forbidden to automatically open the app if it is available!?. Now if the user enters www.domain.com/test.html and i recognize he is using Android and Chrome i tried the intent stuff in a script in a redirected www.domain.com/android_chrome.html:
<script> window.open("intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;S.browser_fallback_url=http%3A%2F%2Fzxing.org;end","_self")
</script>
But the App won't open automatically. If i use a regular Link:
Take a QR code
it works. But i want to let it open automatically!
Google restricted starting intents from javascript apps, that's why it isn't working. Security reasons I guess. You should just display nice big link to let user switch to your app instead of website - or let him continue if he doesn't want to launch the app.
Forcing users into using app is bad, IMO. Splash screen suggesting to use it is okay, but don't push it.

Get a list of installed web browser applications on iOS

Is there is any way to get a list of installed browsers (such as Safari and Chrome) on iOS devices?
In my app, I want to allow user open a web pages using pre-set browser. It should not interfere to default behavior of iOS
Only if the browser has it's own URL scheme will you be able to open a specific browsers.
There is no way in the current SDK to get al list of registered URL schemes, thus you will have to check wether the scheme is supported your self, by calling the [UIApplication canOpenURL:(NSURL *)URL] method.
I'm not aware of any implementation of browser specific URL scheme's
Call [UIApplication openURL:someURL] with a http: scheme will always open safari, custom browser aren't able to override the http: scheme.

Possible to open iPhone Safari and target a specific window?

I have an app that uses OAuth to authenticate, which means the user must be directed to the website to authorize the application. I prefer to make it obvious to the user that they are using a standard browser to authorize at the original site rather than just using a web view to show the content within my app. However, every time they are directed to Safari (via openURL), it launches a new Safari window and once Safari has 8 windows open, it simply fails to work at all.
I'm wondering if there is an equivalen to the "target" attribute of an anchor tag in html which would allow me to cause all openURL calls from my application to open in the same window.
There is other functionality that I can expose via the web application, creating a hybrid app between native iphone functionality and web app functionality in Safari, but if I have to launch a new window every time I switch between the app and Safari, it becomes unworkable. The Youtube app is obviously able to return the user to the previous page after showing a video, but that might well be a custom plugin in Safari for iphone. Also, while returning to the previous page is somewhat useful, sending them to a new URL in the existing window really opens up a lot of possiblities.
I'm pretty sure there is no way to pass a target parameter to openURL:.
What I noticed about Safari is that it won't open another tab if the page you are opening with openURL: is/was already open in Safari. It just reloads that page. This might sound trivial and not helpful but perhaps you could use it to your advantage if you can make your web application only use one page. Different views or states could be expressed with #anchor tags.
An example is http://m.flickr.com. Notice their URL structure? It goes http://m.flickr.com/#/home, http://m.flickr.com/#/explore/interesting/, http://m.flickr.com/#/search and so on. All of these are different web pages to the user but to Safari it's all the same page.
I found iOS 6.0.1 Safari will open the same tab with a simple hashtag, without the slashes. So with the above example http://m.flickr.com, openURL to http://m.flickr.com#someinfo opens to the same tab.
In your webpage, use window.location.hash to return the params. In the above example it will return #someinfo.