|
#1
|
|||
|
|||
|
Is it possible to have a JS that will detect the browser type, then if a match, cause the web page to add a 'filler' .gif at the top of the page?
It seems that IE puts a 'header' of about 20 pixels at the top of a page. NS, Firefox. etc., put about a 10 pix space. This throws off alignment of a DD menu bar (absolute location) located lower in the page. Thanks Keith |
|
#2
|
|||
|
|||
|
Quote:
Quote:
Mike |
|
#3
|
||||
|
||||
|
Quote:
The question of unreliability was raised before (by you?), and is a valid point. But see it this way - 95% of internet users have installed either MSIE, Mozilla or FireFox, which all respond perfectly to browser detection scripts. Fishing after the 5% of people who choose to re-label their browser (for example, Konquerer for Linux changes how it is detected) is not really worth the effort. This 5% know they are going to suffer from some script errors. While reliability is important, we have to keep a perspective. ![]() For more information on browser detection (and redirection in this case), visit http://www.netmechanic.com/news/vol3...cript_no15.htm While it sounds like you need to recode your website to be more compliant with standards (hence varying results over different browsers), your actual request can be fufilled: Code:
<script language="JavaScript" type="text/JavaScript">
if(navigator.appName == "Netscape")
{
document.write("<img src='ns.gif'>")
}
if(navigator.appName == "Microsoft Internet Explorer")
{
document.write("<img src='ie.gif'>")
}
</script>
cr3ative
__________________
Mostly retired member, PM me if you have a specific query to make sure I recieve it :) cr3ation | cr3ation hosting | cr3ation web design | read the stickies |
|
#4
|
|||||
|
|||||
|
Quote:
Quote:
Quote:
Quote:
Quote:
Code:
<script language="JavaScript" type="text/JavaScript"> Mike [1] Unless the OP shows the mark-up involved, it's not possible to say with certainty. |
|
#5
|
|||
|
|||
|
To MWINTER: Thanks a million for the JS - it works perfectly - I used just the NS detection and is does indeed insert the filler pic at the top of the page, thus aligning everything just right. Not only that, Firefox is detected with the same code and it lines up perfectly too! Keith
<script language="JavaScript" type="text/JavaScript"> if(navigator.appName == "Netscape") { document.write("<img src='ns.gif'>") } </script> |
|
#6
|
|||
|
|||
|
Sorry, above thanks was meant for cr3ative
Keith |
|
#7
|
||||
|
||||
|
Quote:
![]() Quote:
Quote:
Quote:
![]() Mike |
|
#8
|
||||
|
||||
|
Quote:
Please could you post an example (screenshot or environment) where you see this script fail? I'm interested. (I know the script is a bad way to fix a webpage, but pcvoyage seems happy )Cheers cr3ative
__________________
Mostly retired member, PM me if you have a specific query to make sure I recieve it :) cr3ation | cr3ation hosting | cr3ation web design | read the stickies |
|
#9
|
|||
|
|||
|
Thanks for your interst, both of you. I know I'm using old and in the way, but it is simple and seems to work. The page I'm dealing with is
http://www.pcvoyage.com/hcc2/allied Without the filler, the menubar overlaps the top of the table (in NS and FF). With the filler, it lines up. Why IE has a 14 pixel larger header by default than the other 2, I don't know, nor want to know! I havne't tried this in Opera, not knowing what they put for head space. Keith |
|
#10
|
||||||
|
||||||
|
Quote:
From Opera: You'll notice that it fails on two counts:
Of course, what if any script "solution" encounters another browser altogether. What will it do when ICEBrowser, Lynx, Safari, or Konqueror loads the page? Will the page appear as expected, will it exhibit the problem as it was originally encountered, or will the "solution" make it even worse? As I've said previously, browser detection is a solution worth considering only if there are no others. In the majority of possible cases, there are. Whether or not you agree that browser detection is an approach which is always doomed to failure (and you'd be disagreeing with a lot of people that are more knowledgable than either of us), you cannot dismiss that last fact. Quote:
If you know a better way of solving a problem, but don't have the necessary information to propose a complete solution, then ask for it. It doesn't do anyone any good to provide sub-standard information. Quote:
Quote:
Quote:
Personally, I don't see the point in the menu at all. You already have the links in place, so you're just duplicating content - almost 30KBs of script to show an unnecessary, unreliable (see below), and inaccessible menu. Quote:
Mike [1] Transitional is fine if it's needed, but it's not here. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
|
|