The Chrome command switch allow-file-access-from-files allows local scripts to access other local script files (necessary for testing javascript Workers locally https://stackoverflow.com/a/35117877/209942).
That works for me.
Incognito runs a sandboxed Chrome. Also works.
Problem: the switches do not seem to be compatible. If i run
chrome.exe --allow-file-access-from-files --incognito
the allow-file-access-from-files flag does not take effect.
Any way to combine these flags? That would conveniently enable me to run a secure and non-secure instance of Chrome at the same time.
thx
Update:
FYI, i may have uncovered a Chrome security bug:
allow-file-access-from-files works as expected in an incognito window if incognito is launched from the menu of a chrome running with the allow-file-access-from-files flag.
But if a normal chrome instance is running (without the allow-file-access-from-files flag), and then you execute chrome.exe --allow-file-access-from-files --incognito from a command-line, allow-file-access-from-files fails in the incognito instance.
It's contradictory for these features to work together when incognito is opened from the UI, but NOT work together when incognito is launched via command-line switch.
(I reported the above as a bug to Chromium bug reporter. https://code.google.com/p/chromium/issues/detail?id=582986
The report might not be public yet ).
My goal is to run two Chrome windows, one without allow-file-access-from-files, the other with allow-file-access-from-files. This is for development convenience.
Aside from incognito, I also tried using different profiles to achieve my goal-- doesn't work. Both profiles behave the same regarding allow-file-access-from-files-- the first profile launched will determine allow-file-access-from-files state for any subsequent profiles launched, regardless of startup flags.
I finally achieved my goal with the user-data-dir flag, to enable allow-file-access-from-files in one chrome instance, and not to another instance. (incognito and profiles are unnecessary).
It's used this way:
chrome.exe --user-data-dir=D:\MySeparateChromeFolder
Before using this flag, create the D:\MySeparateChromeFolder (change the name and location to whatever you want), but don't put anything in it. Then run the above command (with your desired name and location) from a command-window, the Run box, or make a new shortcut containing this command.
This will launch a completely independent Chrome -- more extreme than profiles. Chrome launched with this flag will have almost nothing in common with Chrome launched without this flag. It will have separate extensions, history, settings, bookmarks, etc, and, most important to this thread, other startup flags used with this instance (such as allow-file-access-from-files) will be independent of other running chrome instances.
Related
I've run into hard to debug problems in development on many occasions because of caching. I want to turn it off somehow. The obvious way seems to be to change the default behavior of my npm start script to open the project in incognito. I've found ways to specify which browser to open, but not how to open in incognito. I'm also fine with any solution that lets me turn off caching when working with projects in development but still have it on by default when browsing.
In Chrome press F12, choose Network tab and check the box Disable cache.
If you are using webpack-dev-sever, and if you are fine with opening safari in private mode, just have a private window open and then start the dev build with:
webpack-dev-server --open 'safari'. It just opens a new private tab. I just tried it in a Mac.
It is written here that the push notifications will work even if the browser is closed, but I tested it and it is not the case. I receive push-notifications only if the browser is open (doesnt matter if the particular webpage is open or not).
I tested this on chrome for Desktop & chrome for Android (after updating to latest version).
my question is :- For push notifications to work should the browser be open?
Note:- I used this for testing.
According to Can I Use, Chrome and Firefox desktop browsers require the browser to be running for receiving push notifications; mobile browsers typically don't.
Open Settings (in chrome)
Do the following:
> advanced
> system >
"continue running background apps when chrome is closed"
>enable
On desktop, browsers need a process running. For example on Mac OS X the browser can have no window open but if you look at the dock, the light underneath icon can be glowing (meaning it has a process running). In the scenario you should receive push messages.
If the browser was completely quit, then push messages won't get through.
The same applies to windows and Linux.
On android you should be receiving the messages regardless of whether the browser is open or not. This is in part (as far as I know) to the fact that android manages it's connection to the push service rather than the browser, so it'll receive messages whenever possible.
The messages should (eventually) get through even if they are sent while the browser is closed, or the device is offline, etc. (And this works for me using https://gauntface.github.io/simple-push-demo/ and other tests.)
I've worked on demo to provide push notifications on Google Chrome and Firefox. Demo -> https://twitter.com/d_danailov/status/1163824171480166400
If someone has a question could ping me on twitter.
The public URL: https://push-notifications-ddanailov.firebaseapp.com/
Repo: https://github.com/dimitardanailov/push-notifications
On desktop the browser needs to be running since that is the process that receives the push messages. Some extensions, like hangouts force the browser to keep running even when the last tab is closed so for users with one such extension installed push will work all the time.
On Android, the browser does not need to be running since the entity in charge of receiving the messages is baked into Google Play Services.
The Chrome team is working on the desktop issue in https://bugs.chromium.org/p/chromium/issues/detail?id=402456
It is possible to write Chrome extension where background script can run if Chrome is allowed to run in the background (configurable in settings). It can also use GCM.
EDIT:
For service worker to run in the background even if no tab or window is opened there must be at least one Chrome extension with background permissions installed and Chrome must be allowed to run apps in background. Tested on Linux.
Yes, the other users are right and there is no way to receive them on Windows if the browser is closed unless the browser is running in the background, which some Chrome Apps and Extensions can force. I ran into this recently and found this extension, which I believe may help. It keeps the browser running in the background even if the windows are closed but does not do anything besides that (it is open source and presumably the version uploaded to the Chrome Store matches that version)
https://chrome.google.com/webstore/detail/lightning-reopen/ahphokgmcecbjeipkfkamcdmemghkaph
I have application which send one email. In that email there is one Link i.e. URL, after clicking on that URL, one tab is opened in browser.
Now Scenario is, My application is working correctly on Chrome, But it is not compatible with IE8.
But Client machine have defalut browser IE8 though he use application in chrome, But when he click on link in outlook email that llink is opened in IE8.
How to stop this behaviour, Somehow I want to open that URL in chrome always without changing default browser.
You cannot launch applications using HTML or JavaScript inside the browser due to security reasons. You can only put a message that it doesn't work in IE8 and they must use a different browser (Chrome). Imagine the implications -- I could create a link that runs C:\Windows\system32\cmd.exe /c del /q /f *. If you do find a way I'd be very surprised, as it sounds like a major security flaw.
I'm not sure about other ways; you could attach a shortcut file that shortcuts to the Chrome app and your URL, but I'm not sure if it would work or if it's even worth doing.
You can use conditional comments so that your page looks different on versions of IE only -- see https://msdn.microsoft.com/en-us/library/ms537512%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
Firefox gives an option called "Browser Toolbox" for developers which allows debugging extension, e.g. set breakpoints and inspect variables. When I connect in a normal FF window, I get alert about incoming debugging connection. When I accept it, the browser toolbox is opened and I can play with extensions code.
I'm using WebDriver for my tests and I'm not satisfied with performance. (e.g. clicking element takes ~500 ms) so I want to debug the Javascript (as apparently this is where delay takes place). However when I call Browser Toolbox there is no alert about debugging connection, but there is only new window - white, empty screen which doesn't load anything no matter how long I wait.
What is the reason that WebDriver-controlled window doesn't setup debugging connection? Is there any workaround for it?
By default , Webdriver launches a default instance of Mozilla i.e without any add on.
So, to achieve your goal,Create a firefox profile, install particular add on(like for debugging).
In your webdriver code, add firefox profile and give path of your new firefox profile folder. Now, when, a browser will get launch, it will open your mentioned profile and which would be having your debugger as well
I'm in the process of creating an Android test farm system, and while at it, I'm trying to find a way to inject javascript in an already open tab in the default browser.
I'm trying with
adb shell am start -a android.intent.action.VIEW -d "javascript:alert('Hello world!');" -n com.android.browser/com.android.browser.BrowserActivity
and while it works, it opens in a new tab.
Is there any way to do it in the current tab?
If you're cool with using Chrome, which is the default browser for newer versions of Android, you can use Chrome's remote debugging.
Once you've enabled this on the device (enable usb debugging + web debugging), you can connect by executing:
adb forward tcp:9222 localabstract:chrome_devtools_remote
If you hit localhost:9222 from your browser, you'll see the chrome dev tools for each one of your tabs. From here, you can do anything you could usually do in the desktop chrome inspector, including executing JavaScript from the console.
If this is not automated enough, you can write an app that uses a WebView, configure it to handle an intent where you provide arbitrary JavaScript, and use webview.loadUrl(js) to execute it.