Javascript detection with ext. .js

Results 1 to 2 of 2

Thread: Javascript detection with ext. .js

  1. #1
    Max W. Guest

    Default Javascript detection with ext. .js

    &nbsp;<BR>Hi there --<BR><BR>I am making the mother of all external javascript files, and I need to detect the version of javascript being used WITHIN the external file.<BR><BR>That is, I cannot do --<BR><BR>&#060;SCRIPT LANGUAGE="JAVASCRIPT1.2"&#062;<BR> var js_ver=1.2<BR>&#060;/SCRIPT&#062;<BR><BR>-- for every verison of javascript, as this is not allowed in an external .js!<BR><BR>Any ideas?<BR><BR>One thing I was thinking is to detect objects that only exist in specific versions of js. For instance, I know that if this code:<BR><BR>if(document.images)<BR><BR>is true, then it is at least js 1.1 since that is when the images object was introduced. However, other attempts at using this logic (like doing a if(document.anchor) -- which came to be in 1.2 -- don&#039;t seem to be working).<BR><BR>Any ideas are appreciated!<BR><BR>I&#039;d love to be able to detect from version 1.1 all the weay up to 1.5! (I am starting at 1.1 because 1.0 didn&#039;t have external js files!).<BR><BR>I remain,<BR><BR>Max W.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Javascript detection with ext. .js

    JS version is linked to browser version, generally speaking. your best bet is to parse tha navigator.userAgent string.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts