I have multiple apps that are installed via web browser.
I can later launch all apps from a link using this
location.href = appname://launch:00/
However when I have this,
location.href = 5appname://launch:00/, it breaks and gives "invalid URL" errors.
The same method works in IE, just chrome is breaking,
if I try //5appname://launch:00/ I lose the console error but the app doesn't launch
I know the number in the start is the issue.
I can't really change app names. Any way to get this to work
Related
We are implementing a Chrome App that runs in a controlled environment on a specific machine under Windows. We have complete control over the environment, including using command-line args to run Chrome, changing registry settings, etc.
Part of the functionality of the app is to take screen captures and stream them to a remote machine. When this feature is initiated, Chrome displays the permission dialog ("Chrome wants to share your screen...") and requires validation by the user.
In the context of our app, this is poor user experience and we would like to find a way to suppress this dialog. As I mentioned, we have complete control over the host machine. Is there any way to do this short of making our own custom Chrome build?
Try running Chrome with the command line argument --auto-select-desktop-capture-source="Entire screen". Source: Chromium issue. Also related: Issue about force-installed extensions and desktop sharing.
In case you want to compile chrome yourself, this would be a good starting point for whitelisting your own extension
For C# Selenium Users. Do not put the "Entire screen" in double quotes.
use it as --auto-select-desktop-capture-source=Entire screen //<--observe no double quotes
var chromeOptions = new ChromeOptions();
chromeOptions.AddArguments("--auto-select-desktop-capture-source=Entire screen");
var driver = new ChromeDriver(chromeOptions);
After I saved my PWA (Test App) built using Create React App to homescreen and launched the app in standalone mode on android using chrome and iOS using safari. Then in the app I initiate Firebase method signInWithPopup(GoogleProvider) the device asks me if I want to open the action with Test App or other browsers installed on device i.e chrome, firefox. If I select to open with my Test App the popup opens and I select the correct Google account.
Error: After the google account selection the popup closes without ever redirecting back to my Test App.
If I instead to open the Firebase method signInWithPopup(GoogleProvider) with chrome browser and not my Test App the popup opens for google account selection and after I select the google account the popup closes and redirects back to the Test App momentarily and then
Error: directs back to chrome tab where is asks for google account to select while showing a loading indicator, and just hangs there.
There are no console error or warnings that come up .
Note 1: The error of popup not closing and staying in loading also occurs if I add the App to homescreen on a Windows 10 x64 machine using Version 64.0.3259.0 (Official Build) canary (64-bit) and launch as a standalone window.
Note 2: The error also occurs for signInWithPopup(Facebookprovider) and signInWithPopup(Twitterprovider) Also If I uninstall app from Homescreen and launch purely in browser the signing in OAuth flow works fine.
Note 3: After further troubleshooting it seems the error more specifically occurs when user input is required in the OAuth popup.
i.e If for example if user has previously given the Test App permissions through Facebook, the flow works fine and the popup closes. Also if only a single google account is detected and it has previously given app OAuth permissions then the popup works as it should. But If multiple google accounts exists on device then the user has to input a selection of which account to sign in through --> this leads to the previously mentioned error again. And using Twitter OAuth the error occurs every-time because twitter popup requires user to select Authorize App every-time.
UPDATE: I believe this may have something to do with google chrome recent changes to OAuth from Webview.
GIf of the error on windows machine: notice the popup for twitter auth never closes, even after authorizing the app, same thing occurs for google and facebook OAuth.
Reading Google documentation:
https://firebase.google.com/docs/auth/web/google-signin
Authenticate with Firebase using the Google provider object. You can prompt your users to sign in with their Google Accounts either by opening a pop-up window or by redirecting to the sign-in page. The redirect method is preferred on mobile devices.
So you have 2 options:
firebase.auth().signInWithPopup(provider)
firebase.auth().signInWithRedirect(provider)
The second must be used when you are into a mobile device.
So the question is: How I detect when I running into a mobile device ?
Code must be something like:
if ( isInMobileDevice) {
firebase.auth().getRedirectResult().then(function(result) { .... }
}
else {
firebase.auth().signInWithPopup(provider).then(function(result) { .... }
}
Sorry, Im still searching the way to get the correct value (true/false) into "isInMobileDevice"
you can stablish in the manifest of the app "display:standalone" then detect the launch mode like this
function isRunningStandalone() {
return (window.matchMedia('(display-mode: standalone)').matches);
}
...
if (isRunningStandalone()) {
/* This code will be executed if app is running standalone */
}
Good news, fixed in Chrome Canary
https://bugs.chromium.org/p/chromium/issues/detail?id=771418#c84
I have a Google Site with an embedded Google Script that allows a user to upload a photo. After validating that the photo is a MIME image type and smaller than 3MB, I copy it to a folder in my Google Drive.
This functionality works perfectly from my Mac laptop (both Chrome and Safari) and my Android phone (Chrome), but when I try it from my iPad (both Chrome and Safari), I get:
NetworkError: Connection failure due to HTTP 500.
I'd thought that the error was in my Code.gs, but I've stripped my processForm() code down to return true, and it still throws this error. So now I think the error is happening in this call in my HTML file:
google.script.run
.withSuccessHandler(reportSuccess).withFailureHandler(reportFailure)
.processForm(formData);
I tried wrapping this code in console.log() calls, but then I realized that iOS doesn't let me see the console. :P
Somehow the "NetworkError" exception is thrown in this call; it's then caught and reported by the failure handler reportFailure.
Again, this script works on my Mac laptop and my Android phone, just not on my iPad (or a colleague's iPhone).
Does anyone have any ideas about (a) what might be the root cause of this problem in the interaction between Google Script and iOS's networking layer and/or (b) how I might work around it?
Since this is perfectly working on your browser from Mac laptop, it maybe that Apple does not yet allow Google App Scripts to run on these devices(iphone & ipad). I found a note on iOS Quickstart for App Script that maybe hinting at this:
Note: The application does not conform with Apple's iOS Human
Interface Guidelines. It is intended only to illustrate the basic
concepts and steps needed to begin working with the Google Apps Script
Execution API.
I'm trying to register a chrome app to get a registration id so I test but the chrome javascript console is showing:
Uncaught TypeError: Cannot read property 'register' of undefined
I don't know what's wrong. I got the example from: https://github.com/GoogleChrome/chrome-app-samples#push-messaging
Seems your Chrome APIs are not loaded.
You need to make sure your Chrome APIs are loaded in order to use the push messaging methods.
In order to load the Chrome APIs correctly, follow the step 5 in Chrome developer page to launch your app or extension. For some newer Chrome browser, you can go to Settings -> Extensions -> Load unpacked extension
Had the same problem,
Eventually the problem was that content scripts cannot use a lot of chrome.* APIs.
GCM is one of them.
Source
I have a Chrome Packaged Web app (which is required as it needs to access the Serial Port), and I'd like to be able to launch it from my website (with some data) when I click on a link/button on that website.
It'd be even better if it could detect if the user wasn't running chrome or didn't have the web app installed and could direct them to the right place...
Are there any examples? It seems like an obvious thing to want to do, but I'm really struggling to find anything...
To launch an app you can use url_handlers, a new feature recently landed (should make Chrome 31). You can pass data in the URL.
You can check if an app is already installed, and initiate the install if not, by using the chrome web store's inline install functionality.
Found a better solution to this problem.
In #Vincent Scheib solution you have to redirect the user to /some/url, or open a new window (that can be actually blocked as popup). All of this it's not so good from an UX aproach.
My solution is to create the app and configure the externally_connectable. You have to pass the url domain of the web site that will try to open the app. For example:
"externally_connectable": {
"matches": ["*://developer.chrome.com/*"]
}
Then, in your packaged app in your background script, you can do something like this:
chrome.runtime.onMessageExternal.addListener(function(message) {
if(message.launch){ //This parameter will be passed in sendMessage method below
chrome.app.window.create("main.html");
}
});
Finally, to trigger the app open you have to send a message using your packaged app id. For example:
chrome.runtime.sendMessage("mdoedhlejmepngilmgoenbhmipoclckb", { launch: true });