Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Help! How to fix this nasty code?
Old 08-15-2007, 07:46 PM Help! How to fix this nasty code?
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Part of a javascript created in ASP:
Code:
   var g_BrowserName = '<%=HttpContext.Current.Request.Browser.Browser.ToUpper() %>';
   var g_BrowserMajorVersion = '<%=HttpContext.Current.Request.Browser.MajorVersion.ToString()%>';
Now I did a Google about how to work with java scripting before starting this thread, and came up with:

Code:
   var g_BrowserName = navigator.appName.toUpperCase();
   var g_BrowserMajorVersion = navigator.appVersion;
Only when I dump out the variables, the appVersion doesn't get me what I need. Plus, each browser reports it totally differently.

Safari:
NETSCAPE
5.0 (Windows; U; Windows NT 5.2; en) AppleWebKit/522.13.1 (KHTML, like Gecko) Version/3.0.2 Safari/522.13.1


Internet Exploder 7:
MICROSOFT INTERNET EXPLORER
4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727)


FireFox 2:
NETSCAPE
5.0 (Windows; en-US)



So what do I do?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-15-2007, 08:16 PM Re: Help! How to fix this nasty code?
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
That would depend on what you're trying to accomplish. What's that Javascript ultimately doing in the grand scheme of things?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 08-15-2007, 08:30 PM Re: Help! How to fix this nasty code?
Learning Newbie's Avatar
Defies a Status

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,662
Name: John Alexander
Trades: 0
Wow - apparently not very much, or my search within files tool is lieing to me. I found two different references - one to the line I pointed out, and the other to:


if(typeof(g_BrowserName)!= "undefined" && typeof(g_BrowserMajorVersion) != "undefined")
{
if(g_BrowserName == "APPLEWEBKIT" && parseInt(g_BrowserMajorVersion) < 125)
{
eval(btn.onClick);
}
}
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 08-15-2007, 10:23 PM I tried sommething...
Novice Talker

Posts: 9
Trades: 0
Here is this code just copy it and try it on your browser. I tried it on main and it works
This is the code:

<SCRIPT LANGUAGE="javascript">
var an = navigator.appName;
var av = navigator.appVersion;
document.write("You are using <B>" +an+
"</B>, version " +av+ ".<BR>")
</SCRIPT>

This came out on the screen:

You are using Netscape, version 5.0 (Windows; de)


But don't forget this is an information for my browser
giche is offline
Reply With Quote
View Public Profile
 
Old 08-15-2007, 11:34 PM Re: Help! How to fix this nasty code?
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
Seems to be looking for an old Apple browser of some sort. I'm just not sure what.

What's probably confusing you, in conjunction with that function, is this line here:

var g_BrowserMajorVersion = navigator.appVersion;
Change that to:

var g_BrowserMajorVersion = parseInt(navigator.appVersion);

You'll have a better idea of what's going on then.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Reply     « Reply to Help! How to fix this nasty code?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.15333 seconds with 12 queries