How browser open a desktop application? [duplicate] - javascript

I need to launch program from browser(like battlefield when you see dialog with confirmation of starting app). Should I make an extension or there is native way to do it with javascript?

If the basic idea is to launch a desktop app from the web browser, the first step is to create a new Registry in Windows and path a URL Custom protocol. And if you need it you can also send parameters by changing console arguments in your app and append the parameters in your html file.
You can check here:
https://weblogs.asp.net/morteza/How-to-run-a-desktop-application-from-a-web-page

check out: Running .exe from Javascript
There are cross-browser compatibility issues with executing a .EXE on a clients machine. i would suggest you look into alternative languages such as Java or even Flash. But it can be done in Javascript.
-normally i wouldn't answer a question like this, but i saw someone say it's not possible. ANYTHING is possible.

Related

Enable Javascript on apache2

I'm currently doing my first steps with webdevelopment, using html, php and Javascript.
I've setup a apache2 server opn my locale machine, and the php part ist working fine.
I've also tried to habe some javascript on my website (a google maps-map using the maps-api), but it is not shown on the website.
I've searched for this problem, and it seems, that I have to enable javascript first for apache. How do I do this? is there just a config file to edit, or do I need to install some kind of plugin?
Thanks for your help in advance!
Tim
If it's javascript to be run in the clients browser, you don't have to install or enable anything on the server. The client needs javascript enabled in his browser (which is the default for most modern browsers).
This is probably the case. First of all, make sure your JavaScript code is between javascript anchors (<script type='text/javascript'> and </script>). Then, access your website in Chrome. If things are not working correctly, use Ctrl+Shift+I (or Cmd+Alt+I on macOS) to view the Chrome console where you might find more information on (potential) errors.
If it's javascript to be run on the server, you probably need Node.js.
Ah, I've found the issue... I just was not calling my javascript function.... I'm sorry, this was a fail on my side....
BUt thanks anyways!

How to execute a program from an unhosted HTML file without using Internet Explorer?

I'm attempting to create a front-end to launch several programs using HTML, CSS, and Javascript. My problem, however, is that the only ways that I can find to run a file either rely on Internet Explorer (Which I am not going to use) or download a new copy of the file.
Basically, I want to click a button or an image (Not 100% sure which one yet) and then run the program at the specified location. This isn't actually being hosted on a webserver; I'm just doing it because I make crappy GUIs in other languages, and HTML is comparatively easy.
This is also on Windows 7, if that has relevance.
I did something similar last year and used NW.js for it, it´s a webkit browser with integrated node.js functions.
It has its own executable and has access to your filesystem through node.
It was fun and easy to use, maybe give it a try.
If running your HTML files in a browser using the file:// protocol isn't an option, choose the technology you're the most comfortable with and look for a way to display webpages through it.
For instance you can have a look at:
WPF WebBrowser component (if you know a bit about .Net)
Java FX2 WebView (if you're more of a java guy)
etc...

EXE from JavaScript [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
How can I run a program or batch file on the client side?
I am new to JavaScript. I am trying to execute an EXE file from JavaScript on the web browers. How can it be done with simple code?
That is not possible due to security reasons. Imagine you are trying to access the file system of the client.
This is usually disallowed due to security reasons, if you absolutely need to do this then you have a few options however:
Prompt the user to download and run the executable
Use the WScript.Shell object
See this question for details on how to do this.
Note that this almost certainly won't work on most browsers unless your site has been placed into some sort of "trusted" zone (which may be the case if you are developing an intranet application or running inside a Html Application / .hta)
Use an ActiveX control (this will also require elevated permissions, however it is more likely that you will at least be able to prompt the user for permissions)
All 3 of these options require trust to be granted by the user (they will either have to have placed your page / site into a certain trust level, or they will have to have clicked on some sort of "trust this site" / "download this file" dialog.
(Also note that all of these options are speicfic to the Windows operating system)
As sAc says, it's not possible to directly run an exe file, though you may want to look into Google NaCl if you wish to do native code execution in a web browser. Also, please note that exe is a Windows format, and it would be very uninterpretable with other OSes and detrimental to the open web if you could run them through a browser.
It is possible if you lower the security level on your browser ..BUT that's not a good idea!
for example, in IE you can do this:
write a run function:
function run(file) {
var ws = new ActiveXObject("WScript.Shell");
ws.run(file);
}
and then for example: ....
onclick = run("file:///C:/Program%20Files/My%20Documents/yourFile.exe")

How to create a Firefox add-on using Objective-C on Mac OS X?

More precisely my goal is to create an add-on (or plug-in?) which is able to communicate with my main Cocoa application using something like the NSDistributedNotificationCenter. I need to be able to inject JavaScript code into the current webpage and get return values from the JS calls when my add-on receives the request to do so by my main application. Then I need to pass the return values back to my main application for processing.
Alternatively if there is a simple way to call JS in the active Firefox webpage and get return values that would also do the job.
If you want more info on why I want to do this, you can look at my other question: How to send JavaScript code to IE using C# (.Net 3.5), run it, then get a string return value from the JS code?
Note that I'm not only interested in knowing how to make a Firefox add-on but also in everything I talked about above. For example, how to inject JS into the active webpage, etc.
I'd like guidance on what technologies to use, tutorials and sample code if possible. The best would be a sample Xcode project but I'm not counting on this :P
Thanks in advance!
N.B: I'm working on 10.4.
You could try using C-Types with FF, which is a regular dll being called by Javascript in your addon, this is WAY better approach that using XPCOM, because if the Interfaces you use in there can change in each FF version, indeed you will have to do multiple dlls each for your addon supported FF versions
Go here my friend->
https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes/Using_js-ctypes
First learn how to write add-ons for Firefox. Adding Objective-C code afterwards is the easy part.
I know there is source available to the OSX FF Plugins for displaying download progress over the Dock Icon (http://github.com/vasi/firefox-dock-progress) and the "pdf plugin" that allows FF to do in-line PDFs is on Google Code.

How do I run a system command in a cydget using objective c or javascript?

I am trying to run a Ruby script from a cydget (cydget is a framework made by Saurik for writing lockscreens on the iPhone, using cycript, which is a mix of javascript & objc - see http://www.cycript.org/ ) The script will first check to see if a WEBrick server is running, if so it will quietly exit, if not it will start the server.
Apparently the iPhone doesn't support NSTask, and I don't know if the cycript implementation of obj-c does or not. (To be honest, I have no clue how obj-c in cycript works at all!) I'm not worried about security, because I'm running 1 specific command: "ruby server.rb", and everything else will be handled through the web server itself.
Is there any way other than NSTask in objective-c, or any way in javascript or HTML that I can run an arbitrary command on the local machine?
Thank you!
Brent
You can't fork another process on an iPhone at all (assuming we're talking about a legitimate app developed against Apple's official SDK). No NSTask, no fork()/exec(), no system(), nothing.
So it sounds like the best solution is to just wait - Saurik will be coming out with a way of directly using Ruby in a cydget, but it likely won't be out for a few months... :( I hope it will be worth the wait though!

Categories

Resources