Detecting if java is installed and enabled with javascript - javascript

I need to be able to determine if a user has Java installed and enabled through JavaScript. The 1st requirement is easily done, I'm using the deployment toolkit script:
http://download.oracle.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html
However, in the situation where a user has java installed, but they have disabled it (NOT disabled support in the browser, but disabled via the java control panel in Windows), the installed versions still show up in calls to deployJava.getJREs(). Is there any way to detect versions of Java that are both installed AND enabled using JavaScript?

See Detect if an applet is ready at Real's HowTo. AFAIU that should only be true once the applet is loaded and started.
There are also ways to call applet methods directly from JavaScript, if the first technique fails, you might look to that in order to ensure the applet is both loaded and working.
Another approach is to set a meta-refresh redirect element in the HTML, then have the applet call a JS to cancel the redirect if it loads successfully. The idea would be to set the href of the redirect to point to a page with words to the effect 'Sorry, our applet failed to load within NN seconds. Click -here- for support.'

Related

Windows Phone 8 WebBrowser does not run javascript

I'm trying to build a WebBrowser application that targets Windows Phone 8 SDK, I had another one for WP8.1 and WebView and now i want to support earlier OS version. The thing is, the capability of executing javascript (either internal script or injected script) after WebBrowser makes a post request is impossible.
I tried posting data using 2 methods:
send a HttpWebRequest request and save result into a local html file and then tell the WebBrowser to navigate to.
simply just call Navigate(uri, data, headers) on WebBrowser to let it post data
Both 2 methods failed to execute javascript after the result had been returned including script inside < script > tag in html and script I injected on LoadCompleted event. The javascript code is simple enough, I tested it thoroughly and made it works with WP8.1 version so it should be no error in my script (by the way, there is no good way to debug js in WP8 like WP8.1 even in Visual Studio 2013 - that sucks).
Anyone has any clue what is going with this old WebBrowser control or any workaround that I can go for this case?
The WebBrowser.IsScriptEnabled Property defaults to false. Set it to true if you know that the script in your page is safe and want to run it.

any way to auto-execute custom js lib function on external websites?

I was wondering if there's any way to attach a js lib to an external webpage after the page has loaded?
To provide a simple example, could I load www.google.com into IE and somehow display the webpage with a green scroll bar?
I would like this process to happen automatically on each page load instead of having to manually execute this process on each page load.
I am assuming that you are talking from a web developer's point of view.
I don't think it is possible without any hacks.
This would also be a huge security risk, because loading javascript code on an external website means that the code can potentially do anything on behalf of the user. It can capture keystrokes, take screenshots, note down passwords and do a lot of illegal stuff.
So instead of this, you can create a browser extension (add-on) which will have to be installed by user's permission (and his knowledge), and can run any code on any page (if the user allows it)

How to use a greasemonkey function

I'm new to greasemonkey and I've a script (which I'm serving) that uses GM_xmlhttpRequest. I was wondering what I've to reference in order to use this function. Like I said, I'm serving this script so I've no idea if the user has GreaseMonkey installed.
Thanks
You can not "serve" script that uses GM_xmlhttpRequest(). GM_xmlhttpRequest() will run in the protected Greasemonkey sandbox (or the protected Chrome userscript sandbox) only.
You can host a proper user script and ask that the user install it, but the user is under no obligation to do so.
If you want your page to have some king of cross-site AJAX capability, you cannot use GM_xmlhttpRequest() in its JS. You'll have to use one of the standard workarounds.
If you installed scripts appropriately (like from userscripts.org), the GreaseMonkey should be able to detect them. You can see what scripts are currently being used by right-clicking on the GreaseMonkey icon on the lower right-hand side of your screen. Some scripts work automatically, and some scripts require the browser to be restarted first. When Greasemonkey detects a page that a script applies to, it automatically runs the script. No need for you to do anything.

How to execute shell scripts from a web page via javascript/jquery and get its results in a string?

in a simple html file opened locally via firefox I need some javascript code to execute a command (maybe "ls") and get it's result in a string I can use in js/jquery to alter the page contents.
I already know this is a generally bad idea, but I have to make this little local html file capable of running several scripts without a server and without cgi.
In the past I've used to install a plugin in TiddlyWiki (www.tiddlywiki.com) to execute external commands (firefox requested authorization for every operation), so javascript can do it, but how to get command result in js after execution?
I don't believe there's any way to do this without a cooperating browser plug-in. The browser plug-in would be told what command to execute via javascript, it would go execute that command and then call you back with a callback when the results were available. This could be very dangerous as giving the browser access to your local system in almost anyway opens you up to lots of types of attacks (which is why browsers don't offer this capability).

Can WPF/XBAP App be embedded in an HTML Page and call some javascript (like Flash does)

Can WPF/XBAP be embeded like Flash which can either run directly as swf or as embedded in an html page and communicate with it by calling javascript.
I believe you can't do that with WPF/XBAP, you should take at Silverlight.
XBAP can run only in the browser but only "full page" with no html around it, non-XBAP WPF runs standalone only. Sliverlight can run as part of a page, I'm almost sure it can interact with javascript on the page and it can run "out of browser" (but not simply by double clicking on a file, you have to run it in a browser and have an "install" option in the app)
If someone is still trying to find solution for this: I wrote a blog post containing information how this can be properly done. There is lots of outdated information, but this solution works with latest browsers.
XBAP and Javascript with IE9 or newer

Categories

Resources