464

Accessing the browser from JavaScript and Java
Browser information functions example code

  • Query browser information and send it as a string
  • Use a Text node to display the string
  • DEF Introspect Script {
        eventIn  SFTime   trigger
        eventOut MFString message
        url "vrmlscript:
            function update( ) {
                message.length = 5;
                message[0] = 'Browser: ' + Browser.getName( );
                message[1] = 'Version: ' + Browser.getVersion( );
                message[2] = 'URL:     ' + Browser.getWorldURL( );
                message[3] = 'Speed:   ' + Browser.getCurrentSpeed( );
                message[4] = 'Frames:  ' + Browser.getCurrentFrameRate( );
            }
            function initialize( ) {
                update( );
            }
            function trigger( t, ts ) {
                update( );
            }"
    }