简体   繁体   中英

Safari 7, Mac OS X: Determine if Java is in 'unsafe' mode via javascript

Ok, so we have a Java applet, which provides the ability to upload files to server. Some have already noticed , that user needs to turn 'unsafe' java mode for our site in order for applet to work.

One way of determining the 'safeness' of java is try to load a 'fake' applet and see how it behaves. This will take some time to load JRE and is not what I want.

The question is: can we determine if java is running in unsafe mode with JavaScript ONLY? I'm really hoping Apple added such a possibility.

In fact, some links to where this behavior is described would be appreciated.

I believe that you misinterpreted my original post re Java applet and Safari 7. Safari 7 does not actually "blocks" the applet from loading. The applet will be loaded precisely the same way as if it was loaded under Safari 6. The only problem is that Safari 7 (and not 6 and below) actually restricts the applet from accessing file system , if the applet is running in "safe mode" which is default setting.

So if your applet does not need to access local files (and maybe some other I/O, I didn't experiment with other options though) - it won't notice anything wrong.

However, as soon as your applet tries to access local filesystem, it will get FileNotFoundException.

So to me, the best way to check if the applet is in "safe mode" is to simply try to access a folder you know to exist and accessible to the user (I think you can start experimenting with "." or ".."). If instead of accessing the folder you will have FileNotFoundException, you can assume (and suggest to your user) that the applet is running in "safe mode".

Also I am absolutely certain that there is no way to check thru the js if particular applet is in "safe mode" or to inquire if Safari 7 is running all applets in either "safe mode" or "unsafe mode".

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM