Reply
$10 by PayPal for Javascript help
Old 05-30-2003, 10:34 AM $10 by PayPal for Javascript help
Novice Talker

Posts: 6
$10 by PayPal to the first person who replies with a working javascript I can include in my HTML that will load an external javascript file (in the format JavascriptFile.js) only if the visitor is running Internet Explorer 5 or lower under Windows 98 or lower. If you're going to PM or email, also reply here saying that, so there's no debate about who responded first. There are scripts like this all over that just need a little tweaking to do exactly what I want, so it shouldn't be too hard for someone who knows what they are doing. Unfortunately, that's not me (Grin).
Shiftlock is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 05-30-2003, 11:29 AM
david's Avatar
King Spam Talker

Posts: 1,314
Location: Glasgow, UK
This should do it:
Code:
<script language="JavaScript">

<!-- begin head script

var browserName = navigator.appName

var browserVersion = navigator.appVersion

var browserVersionNum = parseFloat(browserVersion)

var agt=navigator.userAgent

var yourOS="unknown"

osok=0

if ((agt.indexOf("Win95")!=-1)||(agt.indexOf("Windows 95")!=-1)) 

   {
   yourOS='Windows 95'
   osok=0
   }
   

if ((agt.indexOf("Win98")!=-1)||(agt.indexOf("Windows 98")!=-1))

   {
   yourOS='Windows 98'
   osok=0
   }

if ((agt.indexOf("WinNT")!=-1)||(agt.indexOf("Windows NT")!=-1))

   {
   yourOS='Windows NT'
   osok=1
   }

if ((agt.indexOf("Win16")!=-1)||(agt.indexOf("Windows 3.1")!=-1))

   {
   yourOS='Windows 3.<i>x</i>'
   osok=0
   }



//Detect IE5.5+
version=0
if (navigator.appVersion.indexOf("MSIE")!=-1){
temp=navigator.appVersion.split("MSIE")
version=parseFloat(temp[1])
browserok=0
}

if (version<=5) //NON IE browser will return 0
	{browserok=1}

dontallow=0
if (osok==0)
	dontallow=1
if (browserok==0)
	dontallow=1
	
if (dontallow==1)
	document.write('<script language="JavaScript" src="filetoinclude.js"><\/script>')



//-->

</script>
It seems to work on my computer but It'll need to be tested a bit more.
__________________
Free Webmaster Help - Everything a webmaster needs - for free
Free-Webhosting.info - Free web hosts reviewed and rated
Web Hosting Hunt - Impartial hosting directory - Add your host today for FREE
david is offline
Reply With Quote
View Public Profile Visit david's homepage!
 
Old 05-30-2003, 11:56 AM
Novice Talker

Posts: 6
As shown in my Apache log file, using the above script, in the last few minutes the server has given the "filetoinclude.js" script to the following browser types:

Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC)
Mozilla/4.0 (compatible; MSIE 5.0; Windows 98)
Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt; (R1 1.1))
Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt; Assistant 1.0.2.4)
Mozilla/4.0 (compatible; MSIE 5.01; Windows 98)
Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)
Mozilla/4.0 (compatible; MSIE 5.13; Mac_PowerPC)
Mozilla/4.0 (compatible; MSIE 5.5; Windows 95)
Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)
Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90)
Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)
Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0; AAFES MSIE 5.01 SP1; Hotbar 4.1.8.0)
Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)
Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Assistant 1.0.2.4)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Perry Local Schools)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; 24SPEED)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Assistant 1.0.2.4)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; YComp 5.0.8.6; yplus 3.01)

So, it appears to be serving only to Internet Explorer users, but all version of Internet Explorer, and all operating systems.
Shiftlock is offline
Reply With Quote
View Public Profile
 
Old 05-30-2003, 09:08 PM
HeidiLynn's Avatar
King Spam Talker

Posts: 1,119
Still won't work though if the person has javascript disabled...
HeidiLynn is offline
Reply With Quote
View Public Profile Visit HeidiLynn's homepage!
 
Old 05-31-2003, 08:31 AM
david's Avatar
King Spam Talker

Posts: 1,314
Location: Glasgow, UK
Hmm... How about this one:
Code:
<script language="JavaScript">

<!-- begin head script

var browserName = navigator.appName

var browserVersion = navigator.appVersion

var browserVersionNum = parseFloat(browserVersion)

var agt=navigator.userAgent

var yourOS="unknown"

osok=1

if ((agt.indexOf("Win95")!=-1)||(agt.indexOf("Windows 95")!=-1)) 

   {
   yourOS='Windows 95'
   osok=0
   }
   

if ((agt.indexOf("Win98")!=-1)||(agt.indexOf("Windows 98")!=-1))

   {
   yourOS='Windows 98'
   osok=0
   }

if ((agt.indexOf("WinNT")!=-1)||(agt.indexOf("Windows NT")!=-1))

   {
   yourOS='Windows NT'
   osok=1
   }

if ((agt.indexOf("Win16")!=-1)||(agt.indexOf("Windows 3.1")!=-1))

   {
   yourOS='Windows 3.<i>x</i>'
   osok=0
   }



//Detect IE5.5+
version=0
if (navigator.appVersion.indexOf("MSIE")!=-1){
temp=navigator.appVersion.split("MSIE")
version=parseFloat(temp[1])

}

if (version>=5) //NON IE browser will return 0
	{}
else
	{
		if (osok==0)
			// document.write('<script language="JavaScript" src="filetoinclude.js"><\/script>')
			document.write('did it')
	}


//-->

</script>
__________________
Free Webmaster Help - Everything a webmaster needs - for free
Free-Webhosting.info - Free web hosts reviewed and rated
Web Hosting Hunt - Impartial hosting directory - Add your host today for FREE
david is offline
Reply With Quote
View Public Profile Visit david's homepage!
 
Old 05-31-2003, 08:13 PM
Novice Talker

Posts: 6
I will try that second script first thing on Monday, and post the results. Thanks.
Shiftlock is offline
Reply With Quote
View Public Profile
 
Old 06-02-2003, 11:09 AM
Novice Talker

Posts: 6
Still no good. The second script isn't serving the external javascript file to anyone, no matter what platform or browser.
Shiftlock is offline
Reply With Quote
View Public Profile
 
Old 06-02-2003, 01:43 PM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Ok can you use php because if you can I have a script that is much more reliable than javascript and just as easy to use.
-dk
__________________
Did I help you? If so, be nice and throw me some TP
dk01 is offline
Reply With Quote
View Public Profile Visit dk01's homepage!
 
Old 06-02-2003, 01:46 PM
Novice Talker

Posts: 6
I've never used php, and don't really know anything about it. My server is running Apache 1.3 under Windows 2000 Advanced Server.
Shiftlock is offline
Reply With Quote
View Public Profile
 
Old 06-02-2003, 08:28 PM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Do you have php installed?
You can check by creating a new page with this as the source:
PHP Code:
<?php echo("Hello world!"); ?>
If opening the page on your server in internet explorer does not show "Hello world!" then you do not have php installed. Oh and by the way... the file must be called myfile.php instead of the normal myfile.html.
-dk
__________________
Did I help you? If so, be nice and throw me some TP
dk01 is offline
Reply With Quote
View Public Profile Visit dk01's homepage!
 
Old 06-04-2003, 11:10 AM
Novice Talker

Posts: 6
Nope, my server is not configured for PHP. I really wanted to do it in JavaScript. I didn't think it would be hard. Oh well.
Shiftlock is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to $10 by PayPal for Javascript help
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.15752 seconds with 12 queries