Shoutbox

Javascript Help - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Javascript Help (/showthread.php?tid=29490)

Javascript Help by king_of_cool_kids on 08-04-2004 at 02:23 AM

I have a site with a boomark link. IE does support bookmark, so displays the link "bookmark this page" text I told it to. But firefox leaves it blank.

I want a code that if viewed in firefox, make it not have a gap like at the moment, but instead display "Press Ctrl + D to bookmark this page" in firefox only. Is this possible??

Something like:

code:
<javascript>
if IE.browser
print: bookmark code here
else
print="Press Ctrl + D to bookmark this page"
</script>
or simalar??
RE: Javascript Help by -dt- on 08-04-2004 at 06:12 AM

http://www.macromedia.com/support/dreamweaver/how...wserinfo_how1.html
tells you how to show a different page depending on what browser the user is using im sure you can modify it to do what you want


RE: Javascript Help by king_of_cool_kids on 08-04-2004 at 07:34 AM

I can't seem to make it work :/ Any help??


RE: Javascript Help by -dt- on 08-04-2004 at 08:53 AM

code:
<html>
<HEAD>
<SCRIPT language="javascript">
<!--
function getversion(){
if(navigator.appName.indexOf("Netscape")>-1){
document.write("press ctrl+d to bookmark this page");
}
else if((navigator.appName.indexOf("Microsoft")>-1) || (navigator.appName.indexOf("MSIE")>-1)){
document.write("blah firefox owns IE");

}
else if(navigator.appName.indexOf("Opera")>-1){
document.write("if opera write something");
}
else{
document.write("if its anything else");
}

}
// -->
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT language="javascript">
getversion();
</script>
</BODY>
</HTML>
here you go ive done it for you :) hope thats what you wanted 
RE: Javascript Help by king_of_cool_kids on 08-04-2004 at 09:01 AM

code:
<html>
<HEAD>
<SCRIPT language="javascript">
<!--
function getversion(){
if(navigator.appName.indexOf("Netscape")>-1){
document.write("Press ctrl+d to bookmark this page");
}
else if((navigator.appName.indexOf("Microsoft")>-1) || (navigator.appName.indexOf("MSIE")>-1)){
document.write("<script language="JavaScript" type="text/javascript">
<!--
var version=parseInt(navigator.appVersion)
var isIE=navigator.appVersion.indexOf("MSIE")>0
var isIE4=isIE&&version>=4 
if (isIE4) { document.write('<a href="javascript:window.external.AddFavorite(document.location,document.title)">Bookmark This Site<\/a>');}
// -->
</script>");

}
else if(navigator.appName.indexOf("Opera")>-1){
document.write("Please feel free to bookmark this page");
}
else{
document.write("Please feel free to bookmark this page");
}

}
// -->
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT language="javascript">
getversion();
</script>
</BODY>
</HTML>
It doesn't work??
RE: Javascript Help by -dt- on 08-04-2004 at 09:53 AM

=/ why are u trying to write javascript into the page?
anyway after i removed where u were trying to write the javascript into the page it worked

code:
<html>
<HEAD>
<SCRIPT language="javascript">
<!--
function getversion(){
if(navigator.appName.indexOf("Netscape")>-1){
document.write("Press ctrl+d to bookmark this page");
}
else if((navigator.appName.indexOf("Microsoft")>-1) || (navigator.appName.indexOf("MSIE")>-1)){

var version=parseInt(navigator.appVersion)
var isIE=navigator.appVersion.indexOf("MSIE")>0
var isIE4=isIE&&version>=4;
if (isIE4) {
document.write('<a href="javascript:window.external.AddFavorite(document.location,document.title)">Bookmark This Site<\/a>')
       }

}
else if(navigator.appName.indexOf("Opera")>-1){
document.write("Please feel free to bookmark this page");
}
else{
document.write("Please feel free to bookmark this page");
}

}
// -->
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT language="javascript">
getversion();
</script>
</BODY>
</html>

RE: Javascript Help by king_of_cool_kids on 08-05-2004 at 01:28 AM

Thanks. It works like a charm.