Google oAuth is not supported in android webView. Google recommends to use chrome custom tab for proceeding oAuth. I have also requirements of js call from my web app to native. How to configure to call native methods from web app using chrome custom tab in android similarly like js interface in webView?
Update 1
This mod Chang marked the post as duplicate but the post is different. I don't want to run any JS in my web app from native. I want to invoke method from web app to my native code via JS interface. Is there any way for CCT?
Based on Can I Inject Javascript Code into Chrome Custom Tabs the answer appears to be no.
Chrome Custom Tab is based on Chrome itself and has the same security model. The web content is only allowed access to the Web APIs (camera, device orientation, etc.) and has no access to the native app. At best the native app can capture a URI.
Even the Chrome Custom Tab documentation state that the way for a native app to handle content:
Some URLs can be handled by native applications. If the user has the Twitter app installed and clicks on a link to a tweet. She expects that the Twitter application will handle it.
Before opening an url from your application, check if a native alternative is available and use it.
Implies that either a native app handles a URL or not. My interpretation of Chrome Custom Tab is a skinnable Chrome component adjacent to the native app rather than internal to a native app like a WebView where a Javascript bridge exists.
Your desire for a Javascript bridge from a web app would mean that there would be a arbitrary way for any website code to interact outside of the web container. The rational as to why that is not allowed is given as the responses in the first link.
Related
I am trying to get Native Messaging between my chrome extension and my c# application. But below are my questions :
How to open only one Native app at a time ?. Clicking on the extension again will open the Native app again & again.
Can I communicate with an already open native app?
I built my extension and native app using the code in the following question.
Native Messaging Chrome
Native Messaging works by starting a new application process, then communicating with it over STDIO as long as Chrome keeps the connection open. If you don't keep the connection open, you can't "reconnect" to an application. To keep the connection open, you'll probably need to open it from the event script.
See this question: How to get Chrome Native Messaging to Listen to application? It discusses some of this topic, including C#-specific ways to keep it a single instance.
Furthermore, consider using alternative solutions, such as web communication (for example, WebSockets) to a local port exposed by your native code, though it creates new security questions (how to make sure it's your extension talking to it?).
I have an electron (4.0) app. I'm using the openid/appauth-js node module.
This module brings up a native browser window when performing openid connect hybrid flows.
(I am using IdentityServer 3 for the server)
I want to use an electron BrowserWindow instead.
The flow works up to the point where the consent screen is shown.
The consent screen has a minified version of jQuery (v1.11.0) followed by Bootstrap (v3.0.3).
The page displays fine in native browser, but in electron I get the message "Bootstrap requires jQuery"
I've tried set the browserwindow option nodeIntegration:true (I appreciate this is overkill). I've partially looked at pre-load aswell, but I think this is undesirable as the web service could be used by other clients.
I've also tried --enable-sandbox together with sandbox: true, but this breaks the main window.
I've also tried debugging the javascript code to identify why it fails to run correctly, but its complicated due to the openid flow interaction.
I require the popup window to execute remote resource javascript like a chrome or other mainstream browser.
Instead Bootstrap fails to recognise jQuery is already loaded
I'm searching about how to expose some functionalities from my android app to a webpage using content provider.
My app stores digital certificates in AndroidKeyStore, i'd like to list this certificates on a webpage using js.
You can do a native app, in java and c++ or an html app with cordova or similar. Content provider belong to native app world. If you need to work with them, i suggest you to build an native app (in java) and do user interface natively.
The best way to do it is using Android WebView and exposing some functions to javascript.
https://stackoverflow.com/a/10389678/2004555
I have website link at which I have designed a html/javascript web app. I used iOS and Android app to create an app that encapsulates the web app.
Is there a way to block access to the website link and only allow access to the website link only thru the native apps calling the link.
In short safari, IE, Chrome must not be able to access the link, but the iPhone & Android app should be able to access it.
Is there some way to tell that the app is accessing the site and not the phone or pc browsers.
I am sure there a number of ways to implement this.
Thanks,
It depends on how is the web app implemented. Since native Web Views are pretty much the wrapper for the standard browser (Safari/Chrome), you will find it tough to filter it based on that.
What you can do, however, is to add an extra GET variable (for ex. &ref=youruniquecodehere) or a custom User-Agent, based on which you will be able to identify, whether your application authorized the request (with a proper access code) or if it's a generic request using browser.
However, both of these options can still be bypassed if researched, although it'd require slightly more time. Not sure whether a solution that would work in 100% of cases exists.
Hope that helps, please correct me if I'm wrong.
I'm quite new to xcode, because I mostly work with JS and HTML5. I've decided to create a simple webview app that enables me to work with JS and HTML5 (going to put it on Github asap)
Now my question is about accessing certian iPhone features that I cannot use in Safari or Chrome (the reason why I'm creating this).
So the question is: is this possible? for example, I can't access the camera (as a fullscreen background I mean) in an iOS browser, but can I use it in webview?
You need any method of communicating between UIWebView and the containing app. There are libraries out there that do just that, some better some less. In case you do not want them... So to outline the techniques to do that:
App talking to the webView - using [webView stringByEvaluatingJavaScript:...]
Webview talking to the app - using url directives. Which is essentialy window.location = ... with custom fake urls, and then parsing the NSURLs in the delegate method webView:shouldStartLoadWithRequest:navigationType: and of course returning NO to prevent actually navigating to your fake urls.
If you find that you are missing consecutive URL requests, you could write a JS function that takes the URLs, puts them all in an array, pops one by one and sending them to the browser in a setTimeout(..., 0).
You need to use something like this - Cordova or PhoneGap ( Both are the same thing )
"Apache Cordova is a set of device APIs that allow a mobile app developer to access native device function such as the camera or accelerometer from JavaScript. Combined with a UI framework such as jQuery Mobile or Dojo Mobile or Sencha Touch, this allows a smartphone app to be developed with just HTML, CSS, and JavaScript."
Here is a description of all the device features cordova or phonegap allow you to use - Plugin API's
Yes, is it possible, but using a web app container like Phonegap.
If you need more info how install it visit this web.