The command:
node-debug sls offline
opens a new browser window every time it is run.
How do we stop it from opening a new window every time? I want to reuse the existing window!
This is a known issue with node inspector. Take a look here.
Since 0.9.0 we use https://github.com/benderjs/browser-launcher2 to
start the browser, and make sure it's Chrome/Chromium/Opera (i.e. the
browsers that can properly render node inspector; we detect installed
browsers in the system and choose the most appropriate one; earlier we
used opener module which just delegated opening the browser to the OS,
which would open the defaul browser, which could have been e.g.
Firefox) and this could be the reason why the behavior has changed.
browser-launcher2 actually does a bit more than just launching a
browser, for instance it creates a new profile for Chrome in a
subfolder of ~/ - this is probably the issue that #CalvinScott
reported (i.e. Chrome that was opened was the new profile created by
browser-launcher, not your original profile; you should be able to
open your original profile of Chrome normally)
Also, you may consider this:
Since version 6.3, Node.js provides a buit-in DevTools-based debugger
which mostly deprecates Node Inspector, see e.g. this blog post to get
started. The built-in debugger is developed directly by the
V8/Chromium team and provides certain advanced features (e.g.
long/async stack traces) that are too difficult to implement in Node
Inspector.
Related
So I'm trying to find a way to add default file extensions options to Firefox. Since for whatever reason it doesn't give you the option?
Example: Settings > General > Applications
I want to add new content types and then be able to select my default application of choice.
The current issue is, that I use an MSP client that when necessary allows us to remote into a client's workstation for troubleshooting. Normally one would just click on the "Start Remote Session," button, and it brings up the application to do so. However, since it operates in some form of Javascript (I think....?), it doesn't technically download a file for me to save and then execute through the app. It just opens the app automatically. It never gives me the option to save the a file or anything like that, that it would use for the Remote Session app.
So I want to figure out how to bypass this issue by just adding the extension needed for this process in Firefox's default content types.
Works on Windows, I'm currently on Linux. (So please don't tell me to not use linux or any form there of. That or to use wine or playonlinux. I already am)
I have a Google Chrome Extension which uses a native host. This is used only on a windows box and the extension's registry settings are added along with the installation of the native host exe. Currently the the port (chrome.runtime.connectNative) or native host is started when the extensions background script is loaded. This currently means that the native host runs whenever Google Chrome is running.
The extension is used for only 1 website "www.example.com" and so content scripts only run when a tab with this website is loaded. This means that the native host would only be needed when a tab with this website is loaded and not all the time.
I now want to also create an Edge Chromium extension and give users the option to use either Edge or Chrome. As I indicated above both extensions would be "installed" meaning the registry keys added on installation of the native host. This means the extensions would be there for both browsers.
My main question is thus when and how should the native host be started.
From this main question I have a whole host of thoughts or questions;
When the user chooses to use Edge or Chromium should I at that point be making the changes to the registry? Problem here is users can of course independently of my app install the extension.
Is there a problem just leaving things as they are. In other words if Edge and Chromium are running then there are 2 different native hosts running and my app simply chooses which native host to communicate with based on the users choice. Problem here is you can see the native host process running in task manager and it would therefore be running for a browser that the user has not chosen which might not be OK for some users.
I thought about the extension having a flag to know if it should start the native host. Problem here is how could I turn this flag on. Without the native host I am unaware of a way to interact with the extension.
There are possibly more options so happy to hear them as well.
changes to the registry
Add chrome-extension://id/ with the id of your second extension to allowed_origins in the host's manifest as shown in the documentation.
there are 2 different native hosts running
Each host is started by its respective extension and it can communicate only to that parent extension, there's no confusion.
a flag to know if it should start the native host. Problem here is how could I turn this flag on. Without the native host I am unaware of a way to interact with the extension.
It depends on what the host and the extension do. Maybe you don't need to run the host all the time or maybe you can start it only when a tab with the matching URL is loaded. Maybe you can use the new experimental onConnectNative mechanism.
Once a node.js program has run to completion in the context of an --inspect session (i.e. via the Chrome dev tools debugger) is it possible to re-start it without having to re-issue the --inspect command from the command-line?
The issue with re-issuing an --inspect command is that it generates a different chrome url every time and one has to then copy-paste this into Chrome each time. Ideally I want to be able to push F5 to re-start the chrome debug session.
So two issues:
I cannot restart the debug session without killing the current (i.e. no way to just refresh).
I have to copy paste the url into chrome each time I start a new session. (not as bad as issue 1.)
Here's a couple of options for you, though neither will provide you with a simple F5 refresh, both are significantly better than copy/pasting the new URL generated by the --inspect flag.
The most optimal solution is installing this extension for Chrome or Opera: https://chrome.google.com/webstore/detail/nim-node-inspector-manage/gnhhdgbaldcilmgcpfddgdbkhjohddkj
This will manage the node inspector for you. Just click the resulting toolbar icon and select "Auto" from the toggle switch. Your browser will then open the Chrome DevTools in inspection mode whenever your node server generates an inspection URL.
If you want to go the low-tech (and more manual) route, or don't want to install a Chrome extension, just open your Chrome to "chrome://inspect", wait a moment, and you'll get a list under Remote Target that will include your Node server. Just click the "inspect" link there, and the DevTools will open with the current URL. The downside of this method is you'll need to reclick that "inspect" link every time your server restarts. It avoids copy/pasting URLs, but still involves manual labor.
It's also significant to note that if you simply update the url of your inspector with the new ID, it will also work.
When you restart node, you'll get something like this:
Debugger listening on ws://127.0.0.1:9222/72c791b7-178f-47e8-93b1-d1be4d5ffe1e
The bit after the port/ is what you want. Replace that code in your inspector's url and it will connect to the latest session.
I want to bundle an extension with my executable, and I want it to automatically add it to the users browser if they have chrome or firefox. Is there a directory where I can drop the .crx file containing the extension for chrome, and chrome will automatically use it? And what should I do for firefox?
If you want to simplify things you can use Crossrider and get an installer which will install your extension on IE, Firefox and Chrome.
This installer can also run in silent mode, so you run it from your executable without interrupting the normal flow.
To do all that, you will first have to open a new user and copy your extension code to Crossrider (which is probably a good idea anyway since then you will have one code for your app which will support all browsers).
For Chrome:
You can put it in the registry or drop it in the external-extensions.json file (%localappdata%/Google/Chrome/Application/chrome_xx.xxx.xxx.xxx/Extensions/).
I never did it myself actually but it's all documented on the official channel:
http://code.google.com/chrome/extensions/external_extensions.html
There's also a way to install it via Group-Policy, but none of all these three methods is cross-platform AFAIK.
For Firefox:
I have no idea.
My recommendation would be:
DO go through the browser itself,
DO NOT try to sneak around and force it onto the user
Reasons for this are:
the browser is meant to ask for the user's permission, clearly and explicitly.
that's the only cross-platform way I know (and it already requires forking out, so that's not even that totally cross-platform).
I'd simply recommend forking out a browser and passing as argument the extension's file or download URL, so that it will automatically request the user's permission and start the installation process.
For instance, just calling this (on linux, if google-chrome is on your PATH):
google-chrome PATH_TO_FOLDER_OR_URL_PREFIX/myextension.xpi
Or:
google-chrome PATH_TO_FOLDER_OR_URL_PREFIX/myextension.crx
Or for Firefox:
firefox PATH_TO_FOLDER_OR_URL_PREFIX/myextension.xpi
I want to launch the browser in a different process when a particular link is clicked on the page. When I checked the net I found the following tip: http://www.dslreports.com/faq/3849 . But there we have to change the registry. Is there any simple way of doing this without touching the registry?
If you use the Google Chrome browser, each new window or tab runs in a separate process. Internet Explorer version 8 will do the same (it's currently in the second beta round).
Earlier versions of IE will run a new window in a separate process if it is launched from, say, the Start menu or the command line, or a link in an email (but not by clicking a link within IE). I imagine you could create a proxy that the client would run through, which would intercept the links you care about and launch them by running a command line request. That seems like more trouble than mucking with the registry though (assuming that registry change still works -- looks like your link is from 2002).
I don't believe this is possible unless you change the client computer setup or software it's running.
Why do you want to do this?