<script type=text/javascript> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> var screen_width = null; var screen_height = null; var resolution = null; if (navigator.javaEnabled()) { var toolkit = java.awt.Toolkit.getDefaultToolkit(); var screen_size = toolkit.getScreenSize(); screen_width = screen_size.width; screen_height = screen_size.height; resolution = toolkit.getScreenResolution(); } </script> <script type=text/javascript> if ((screen_width != null) && (screen_height != null) && (resolution != null)) { document.write('<center><h1>Monitor Details:</h1><br><hr><br>'); document.write('Screen Width: '+screen_width+'<BR>'); document.write('Screen Height: '+screen_height+'<BR>'); document.write('Screen Resolution: '+resolution+'<BR>'); document.write('</center>'); } else { document.write('<center><P>'); document.write('I am sorry but we could not determine the details of this screen.You might not have Java enabled in this browser.'); document.write('</center>'); } </script> helloo this is my second thread....i need help with this....how can i use in my web page....because it keep said that ('I am sorry but we could not determine the details of this screen.You might not have Java enabled in this browser.'); eventhough i think in my IE it has a java enable...please...
It works fine in firefox with java plugin but not in IE. You can use a hidden java applet to perform the same task (grabbing these values from applet through javascript).
Make a java applet with public methods to get these values: import java.awt.*; import java.applet.*; public class MyApplet extends Applet { public MyApplet(){ } public Dimension getScreenSize(){ return Toolkit.getDefaultToolkit().getScreenSize(); } public int getScreenResolution(){ return Toolkit.getDefaultToolkit().getScreenResolution(); } } Code (markup): Compile the applet and insert it in the document using Applet tag: <APPLET id="myApplet" name="myApplet" width="1" height="1" code="MyApplet.class" codebase="." [B]MAYSCRIPT[/B]></APPLET> Code (markup): Dont forget the MAYSCRIPT attribute. Now get the values as: <script type=text/javascript> var screen_width = null; var screen_height = null; var resolution = null; if (navigator.javaEnabled()) { var screen_size = document.getElementById("myApplet").getScreenSize(); screen_width = screen_size.width; screen_height = screen_size.height; resolution = document.getElementById("myApplet").getScreenResolution(); } </script> Code (markup): Thats it.