Can I use NSSpeechSynthesizer from JavaScript? - javascript

I have a short and simple question: Can I use NSSpeechSynthesizer or Mac OS's Text-to-Speech engine from JavaScript (if I'm on a Mac using Safari)? And if so: how?
Thanks!
Johannes

there isn't a way without plugins
A java applet may be able to, but it would likely have to ask the user for permission first.

Related

How browser open a desktop application? [duplicate]

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.

Way to know what Windows service pack version is from the browser?

Is there a way to find what service pack is installed from the browser? It doesn't look like it's in the System.Web.HttpBrowserCapabilities in asp.net. I need a way to warn users that they need to update to XP Service Pack 3 before proceeding and installing some software.
Not directly, no. Unless it's in the browser's UA, there's no way of detecting it without some kind of plugin.
If you can use VBSCRIPT you can get what you are looking for.
The WMI class Win32_OperatingSystem has the properties ServicePackMajorVersion, ServicePackMinorVersion, Name and Version.
Try samples here: WMI Tasks
Hope this can help

Check if JDK is installed through javascript

The topic-title speaks for itself.
Is it possible to check if the client has JDK installed trough javascript?
I know that it is possible to check the os and the browser but is that possible too?
You can check whether the client has java enabled with window.navigator.javaEnabled().
Note that:
The return value for this method
indicates whether the preference that
controls Java is on or off - not
whether the browser offers Java
support in general.
For more information, have a look at https://developer.mozilla.org/en/DOM/window.navigator.javaEnabled
I am presuming you have an Applet or a Web Start application which you want to run.
For those cases Oracle provides the Java Deployment Toolkit JavaScript which helps to detect Java versions and also offers methods to automatically write applet tags and Web Start launcher buttons.
As you can see at http://download.oracle.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#deplToolkit (also contains link to downloading .js file) it can retrieve installed JREs or send the user to installation page of latest one. This might be what you are looking for.
Notes:
This applies to detecting JREs. JDKs aren't used by the browser so there isn't a need to detect them.
It might not work because of privacy settings or other browser/JRE configuration options.
I don't think you can. It would require javascript to access information beyond your browser. Maybe there's some browser specific solutions.
Its not possible to know the version of Java through javascript .If its possible then it will be a security breach.

Serial communication from JavaScript?

Is it possible to communicate over a machine's serial port through JavaScript?
I have to write a short program that sends data to a microcontroller over the serial port that has a GUI and is cross-platform compatible, and I really don't want to use Java's Swing.
JavaScript itself doesn't have any built in functionality to allow you to access the serial port. However, various JavaScript engines (v8, rhino, etc) allow you to write your own custom native objects.
You might want to check out node.js, which is a JavaScript library for v8 that's focused on writing server-side code (rather than web browser client code). It seems that someone's already written a serialport package for that:
https://github.com/voodootikigod/node-serialport
This is an old question, but in case this helps anyone else, Chrome Apps have access to a serial API - http://developer.chrome.com/apps/serial.html - which might help.
It's Chrome specific (obviously..), but Chrome is available cross-platform so might answer the question.
There's a cross platform plugin for serial port communication called jUART.
Yes, it's possible using an ActiveX(I did it). You can make an activeX and use JavaScript to invoke it.
If you prefer, you can make a .net dll and register it using regasm. Take a look at this link
You also can write an activeX using VB6 and register it. Both works fine.
Ps.: if you are using ActiveX, the JavaScript code will run just on IE.
If you have a DLL library (this includes e.g. most Windows APIs) that allows you to communicate over serial port you can invoke it from Firefox chrome code (or content code with universalxpconnect privileges) by using ctypes.
What you could do is to use a Java applet that connects to the local computer's Java application that reads the serial port. The applet would then transfer the data to a JavaScript class or something that can hold the information. Then additional JavaScript code can be used to access the data. It's a complicated solution but should work.
Another way is to create a POJO service.

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.

Categories

Resources