Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 12-20-2006, 06:41 AM   #1
Pete-KT
Workin With The Devil
 
Industry Role:
Join Date: Oct 2004
Location: West Bloomfield, MI
Posts: 51,532
who knows javascript?

Im trying to figure out a way to tell it that if its using IE to use one script but if its useing any other browser to use a different script, I tried usuing regular if else statements but doesnt seem like java likes those
Pete-KT is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2006, 06:54 AM   #2
MoviesBucks
Registered User
 
Join Date: Nov 2006
Posts: 31
if(navigator.AppName== 'Netscape') - it's netscape, seamonkey,firefox or whatever, otherwise it's 99% IE
MoviesBucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2006, 06:56 AM   #3
Pete-KT
Workin With The Devil
 
Industry Role:
Join Date: Oct 2004
Location: West Bloomfield, MI
Posts: 51,532
thats of no help to call the JS in html file
Pete-KT is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2006, 07:16 AM   #4
Calvinguy
Confirmed User
 
Join Date: Oct 2002
Location: European Union
Posts: 1,752
What you are describing sounds like bad programing. You should test if a given function is supported by the browser instead of testing what browser is used.
Calvinguy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2006, 07:18 AM   #5
Pete-KT
Workin With The Devil
 
Industry Role:
Join Date: Oct 2004
Location: West Bloomfield, MI
Posts: 51,532
what i wanna do calvin is in the html tell it if its IE use this .js else use the other .js
Pete-KT is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2006, 07:28 AM   #6
psili
Confirmed User
 
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
Use a server side script to write the .js include:

if($_SERVER["HTTP_USER_AGENT"] == "so and so")
echo "this.js";
else
echo "that.js";

Or, have your .js file alias to a server side script that does the same thing internally.

Otherwise, I tend to agree with Calvilnguy, that's it'd be better to just write cross-platform JS scripts.
__________________
Your post count means nothing.
psili is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2006, 08:05 AM   #7
Pete-KT
Workin With The Devil
 
Industry Role:
Join Date: Oct 2004
Location: West Bloomfield, MI
Posts: 51,532
Thanks psili
Pete-KT is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2006, 08:07 AM   #8
DaddyHalbucks
A freakin' legend!
 
DaddyHalbucks's Avatar
 
Industry Role:
Join Date: Feb 2004
Location: Las Vegas, Nevada USA
Posts: 18,975
Is javascript really necessary?
__________________
Boner Money
DaddyHalbucks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2006, 08:14 AM   #9
polle54
Confirmed User
 
Join Date: Jul 2004
Location: The Beach
Posts: 4,626
Quote:
Originally Posted by psili View Post
Use a server side script to write the .js include:

if($_SERVER["HTTP_USER_AGENT"] == "so and so")
echo "this.js";
else
echo "that.js";

Or, have your .js file alias to a server side script that does the same thing internally.

Otherwise, I tend to agree with Calvilnguy, that's it'd be better to just write cross-platform JS scripts.
are you sure you mean echo????

that's for writing shit in php
__________________
ICQ# 143561781
polle54 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2006, 08:17 AM   #10
psili
Confirmed User
 
Join Date: Apr 2003
Location: Loveland, CO
Posts: 5,526
Quote:
Originally Posted by polle54 View Post
are you sure you mean echo????

that's for writing shit in php
Just meant "echo" the include line to the browser... guess it was more pseudo code I threw in there, than anything else.
__________________
Your post count means nothing.
psili is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2006, 08:46 AM   #11
SmokeyTheBear
►SouthOfHeaven
 
SmokeyTheBear's Avatar
 
Join Date: Jun 2004
Location: PlanetEarth MyBoardRank: GerbilMaster My-Penis-Size: extralarge MyWeapon: Computer
Posts: 28,609
why not just put the 2 javascript together in one file in sep functions..

this would go in body tag or head tag

Code:
<script src=detect.js></script>
<script>
var browser_type=navigator.appName
var browser_version=parseInt(navigator.appVersion)

//if IE 4+
if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4){
document.write("- press any keyboard key to skip to the next picture -<br>");
ie();
}
else
{

notie();
}
</script>
This would go inside detect.js
Code:
function ie() {

alert('Your using internet explorer');

}
function notie() {

alert('Your not using internet explorer');

}
__________________
hatisblack at yahoo.com
SmokeyTheBear is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2006, 01:06 PM   #12
RazorSharpe
Confirmed User
 
RazorSharpe's Avatar
 
Industry Role:
Join Date: Aug 2001
Location: Scotland
Posts: 2,238
hi Pete,

Try this:

http://www.cdnetworx.com/detect.zip

basically, you put the code that is in example.html into the page you want the detection on. Put your firefox javascript into fire.js and your ie specific js into ie.js

should work ... if you have questions, my icq is 125-48-32-18

cheers ...
__________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
RazorSharpe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2006, 02:19 PM   #13
Pete-KT
Workin With The Devil
 
Industry Role:
Join Date: Oct 2004
Location: West Bloomfield, MI
Posts: 51,532
Thanks Razor and Smokey
Pete-KT is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 12-20-2006, 05:33 PM   #14
RazorSharpe
Confirmed User
 
RazorSharpe's Avatar
 
Industry Role:
Join Date: Aug 2001
Location: Scotland
Posts: 2,238
Quote:
Originally Posted by Pete-KT View Post
Thanks Razor and Smokey
no worries mate, glad i could help

...
__________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
RazorSharpe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.