React native: what is the difference between opening an external URL in-app and launching the native browser - reactjs

I am using React native to develop a mobile application, and an external module's function I use to provide the user login flow via an identity provider, opens the link to the sign-in flow in-app, like shown in the header below.
The sign out functionality offered by this module is documented to be obsolete, so I am implementing my own routing to the identity provider using Linking from the react-native node module, except this actually opens my native web browser rather than showing the page in-app (and subsequently fails to redirect back to my app).
My question is, what is the technical difference between an app opening a link in-app like shown above, and the app simply launching the native browser, such as chrome? And would this affect functionality like redirecting back to the initial application once the user process has been fulfilled (my guess is that it should not affect it).

I believe that the difference is that the in-app browser on IOS is an instance of
sfsafariviewcontroller and on Android, is an instance of Chrome Custom Tabs.

Related

Opening new default browser window in plain React on a Mobile while using Facebook browser

Folks,
We are in a unique situation here. Our React site integrates with Signicat for identity solution. Most of our user base comes from Facebook i.e. they use the Facebook app, look at our posts and click on links we post which redirect to certain sections in our website which require identification.
So an example link posted on Facebook group https://example.com/en/startpage-in-english/ is converted into https://l.facebook.com/l.php?u=https%3A%2F%2Fexample.com%2Fen%2Fstartpage-in-english%2F%3Ffbclid%3DIwAR3loYqYOvom5k8_mOww89p5tun5H9HqIIKE1ebwwCcB3PD4jzxpTVyZGCk&h=AT1E3p1ejYWH9l2KhUo8D_RVjl_EzKBat4woeMHgRv7yXpT9Y-EZoBcK26sQtjjBBwAQt7Pt83a-i_k5JCGuvOBWfgB9pZ7Uv8LnDlyphNKc1Og0nl6QIqWd_nFEAva3OWN-PZ3byqsU7K0I5A&__tn__=-UK-R&c[0]=AT0-5n51iPMlSYghORXW8qxYXJQEejQTAhfiDQ3P3DK_ZTZM3GWbN4zXYKf-nyD_hWJdxQccenDp-5VgphfWuD6ZQ0ikeXq4lv4bjLbSJVFP9k4IxeMBT5mDa9jNdYnYlNs-DkXOM-LiPhhl-Obra9CAbtvihe-G7-8. When users click on the link, Facebook by default opens the link in its own Facebook browser. The subsequent steps in our portal need the user to identify himself and when the identification is completed and in the final step the request to Signicat hangs forever.
We identified that this issue is only happening with Facebook browser and hence one of the workarounds was to Open the default browser with the link to our website.
Note that:
a. this is not a React-Native app, our website is built using plain React hence the WebView solution does not work.
b. Facebook browser suppresses "window.open" with "newwindow" call and simply displays the site in the same Facebook browser instance.
So bottom line is, we need a way to Open the default OS Browser from Facebook App/Browser with the link to our site. Hope somebody can help!
Thanks in advance...
SG

Console logs from a react application loaded in an ElectronJS container

I am working on an electron application used for display management. The app is used in malls/restaurants/airports for digital display ads. The electron app internally loads a react web-app and then displays it. The react web-app comes from our vendor who has a platform for displaying ads from different vendors. The react web-app is crashing in some instances (it is not able to find the correct ad etc). I am unable to debug this crash because the console.log messages from react web-app are not shown anywhere.
Is there a way to redirect the console.logs from the react application to some file?
Architecture:
- Electron App is a full-screen container for playing any content.
- Vendor provides a web-app, which plays different ads. This web-app is a react application.
- Vendor web-app crashes, but not able to see those logs anywhere.
According to the documentation, if you are trying to debug a renderer process you can open dev tools for this by calling the openDevToos() method on instances of webContents.
This is an example:
const { BrowserWindow } = require('electron')
let win = new BrowserWindow()
win.webContents.openDevTools()
If you are trying to debug the main process, you should be able to leverage Google Chrome developer tools. If you open chrome and go to: chrome://inspect, you should be able to see your electron instance and click "inspect".
There are a few more options, which you can find here but I am of the opinion that these are the two simplest approaches.
I would also suggest leveraging debugger statements, as it will halt the execution of the code where you declare a debugger statement, and you could pin point more easily where the crash is happening.

Codename One - BrowserComponent: allow browsing only on two domains

How can I force the BrowserComponent to do browsing only on two domains?
Use case: the BrowserComponent has to change page because any legal reason, for example the user clicks a link or the page does a redirect (by javascript, metatag, http header redirect, etc.). If the new page is on domain1 or domain2, it's ok and BrowserComponent can load it; if it's on any other domain, the BrowserComponent should call the O.S. native browsing tool (for example, Android can show a browser picker).
Thank you very much for any help.
That's what BrowserNavigationCallback exists for. It's a powerful tool that allows you to communicate on the native browser thread and can block any navigation that isn't there. FYI Since this is the native browser thread it's crucial that you don't block it and don't access the EDT from it.
The underlying JavaScript bridge is also implemented on top of this where the JS code sends a navigation request to the Java code.

Is it possible to open a web page from a Cortana background app?

Cortana background apps provide deep linking capabilities, which allow the developer to link to a specific page within her app. I'm wondering if it's possible to open a different application instead, for example a web browser.
My current work-around is to deep-link into my app, and then call Windows.System.Launcher.launchUriAsync as soon as my app is launched. However, this means that the app opens along of the web browser. I would like it to not open at all! Is that possible?
From the MSDN page for LaunchUriAsync:
Unless you are calling this API from a Classic Windows application, this API must be called from within an ASTA thread (also known as a UI thread).
Unfortunately, Cortana's background task is not a UI thread. You're running as a background task, and communicating to Cortana's UI via a set of APIs provided for that purpose, which are limited by design.
Anything you try to do that requires you to be in the UI thread is going to fail for the same reason. You could try hosting the web control in your app however to remove the chain-launched browser from the equation.

restrict a web browser from streaming or downloading a file in Windows Phone 7

I am developing an app which is using a web browser control. In this app I want to restrict all streaming and downloading processes using web browser.
For example, if I click on a song link and if that leads to streaming and playing of that song in the web browser itself, I want to restrict such activity.
Is this possible?
Handle Navigating event of the browser. In the handler check the Uri, if you don't like it you can cancel the navigation.
This approach is not actually very reliable, and definitely should not be used for anything security-related.
It may or may not work for you.
OK, plan “B”.
You can handle browser’s Navigated event, in this event call browser.InvokeScript( "eval", JavaScriptSource ); where JavaScriptSource is the JavaScript code that alters the behavior of your target web site however you want.
The downside of this approach — your JS will likely stop working as soon as the web site owner change their JS to incompatible. If you’re the web site owner, you’re fine with that.

Resources