The easiest way to execute a local file from Firefox?

I am developing a web application. I would like to expand my error messages (and their backtraces) so that I can click on the specified file and open it automatically in my PHP IDE.

I would like to make this feature easy to activate so that anyone working in a web application can easily display an error message to point to their local copy of the site and open their IDE.

What - with the exception of developing a custom FF extension - is the easiest way you can come up with a local command (the batch file that invokes the IDE) when you click on Firefox on Windows (7)? I was looking for extensions but no luck. Perhaps using another extension, such as Firebug or Greasemonkey?

Security is not a problem, since it should only work on the developer's workstation, and I can change the settings for local Firefox.

+2
source share
6 answers

You can add a new protocol (for example, "edit: //") in windows ( http://msdn.microsoft.com/en-us/library/aa767914(VS.85).aspx ) and write a small handler that selects the name file from the URL "edit: //" and passes that file to the editor. So I taught Windows to understand txmt links ( http://blog.macromates.com/2007/the-textmate-url-scheme/ ) in how my mac does it.

+4
source

Unable to do this with javascript. But it looks with the firefox add-on. Have a look at this .

+2
source

http://mozex.mozdev.org/

MozEX is an extension that allows the user to use external programs for these actions:

* edit content of textareas (possibly utilizing a spell-checker, color syntax etc.) * view page source * handle mailto, news, telnet and FTP links * download files * ... and many more :) 

A universal handler allows you to enter a list of protocol schemes, for example, "abc: //, def: //" and for processing them. Thus, you simply created your application with a URL that starts with your selected (configured) protocol, and mozex will intercept a click on the URL and send the url for the command you selected as a parameter.

I think this is exactly what you want.

+2
source

I think the closest you can get to this is that the web browser configuration associates a certain mime type with this “helper application” (here the IDE program) and that the HTTP server returns such a file.

Otherwise, security considerations dictate that the browser will not run any "abritrary" program / logic on the client.

+1
source

Pekka

Having read the stream so far, it seems that you want to create an application that somehow authenticates with the server - i.e. the "average user" will not have access to it. If so, then delivering it through the browser is not possible without writing a user extension.

Starting authentication through GreaseMonkey is difficult, but once the client is authenticated, there is no real way to “start” the trace.

If the server creates a batch file or any set of commands (script, shortcut, etc.), you can simply configure the browser (or configure the browser for the local instance of your application) to run the file. The problem is that you don’t have the ability to automatically authenticate!

The only other way I can imagine that you can make it work is with the Java applet, which will be cumbersome and require that Java be initialized every time you want to import a trace.

The problem is that the browser is intrinsically secure. It is designed to protect your computer from malware, rogue sites, etc. Etc., Therefore, without developing a custom extension for the browser, there is no way to make a jump for any applications that work in tandem with the browser.

So, on this note, I suggest you reconsider writing the XUL Firefox extension, as mentioned above. You will probably need to implement some XPCOM code for it to work too. Here are some resources to help you get started:

https://developer.mozilla.org/en/xpcom

https://developer.mozilla.org/En/XUL

http://ted.mielczarek.org/code/mozilla/extensiondev/

https://developer.mozilla.org/en/XUL_Tutorial/Introduction

+1
source

I don’t know which IDE you are using, but for example for Eclipse you can also use the built-in web browser to test your webapp, and the exceptions / traces in the Eclipse console log already have links to the source code discussed. Easy. See if your IDE provides something similar.

0
source

Source: https://habr.com/ru/post/1347770/


All Articles