homepage Welcome to WebmasterWorld Guest from 54.224.179.98
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / WebmasterWorld / New To Web Development
Forum Library, Charter, Moderators: brotherhood of lan & mack

New To Web Development Forum

    
javascript - bookmark this site
HuhuFruFru




msg:965849
 6:07 pm on Feb 27, 2003 (gmt 0)

there is this nice java script for bookmarking a site:

<SCRIPT LANGUAGE="JavaScript">
var txt = "Bookmark this site";
var url = "http://www.mydomain.com";
var who = "My Domain";

var ver = navigator.appName;
var num = parseInt(navigator.appVersion);
if ((ver == "Microsoft Internet Explorer")&&(num >= 4)) {
document.write('<A HREF="javascript:window.external.AddFavorite(url,who);" ');
document.write('onMouseOver=" window.status=');
document.write("txt; return true ");
document.write('"onMouseOut=" window.status=');
document.write("' '; return true ");
document.write('">'+ txt + '</a>');
}else{
txt += " (Ctrl+D)";
document.write(txt);
}
</script>

and i was reading brett's successful site in 12 months and there is this point where he says it would be better not to use java script because SE spiders don't like it.

my question: how really bad is the above bookmark-java script for spiders?

[edited by: HuhuFruFru at 6:08 pm (utc) on Feb. 27, 2003]

 

JamesR




msg:965850
 6:08 pm on Feb 27, 2003 (gmt 0)

You could make that javascript external couldn't you?

HuhuFruFru




msg:965851
 6:09 pm on Feb 27, 2003 (gmt 0)

how do i do this?

jatar_k




msg:965852
 6:13 pm on Feb 27, 2003 (gmt 0)

put your code in a file with a js extension and then put this on the page.

<script lang="javascript" src="path_to_file.js">

[edited by: jatar_k at 6:14 pm (utc) on Feb. 27, 2003]

Birdman




msg:965853
 6:13 pm on Feb 27, 2003 (gmt 0)

<script type='text/javascript' src='/path.js'></script> :)

Man, I thought I was fast that time..not fast enough!

Birdman




msg:965854
 6:16 pm on Feb 27, 2003 (gmt 0)

Hmmm... Is my method wrong? It works on my browsers.

g1smd




msg:965855
 6:17 pm on Feb 27, 2003 (gmt 0)

<script type="text/javascript" language="javascript" src="/path/filename.js"></script>

You'll need the type attribute to keep the W3C HTML validator [validator.w3.org] happy, and the language attribute for really old browsers.

HuhuFruFru




msg:965856
 6:24 pm on Feb 27, 2003 (gmt 0)

aahhh coool, very nice, thank you!

and when i do it external, then there is no problem with the spiders, right?

g1smd




msg:965857
 1:39 am on Feb 28, 2003 (gmt 0)

Most spiders cannot (yet) follow Javascript-written links, so it is best not to use Javascrit to generate code for links. Howevder this sort of Javscript is fine, whether internal (on page) or external (separate file). Having the code as external means the browser will cache the file, and you can reuse it across the whole site. Each HTML file will need only one line to call it.

You get a similar advantage for CSS by using external files for that, too.

HuhuFruFru




msg:965858
 8:14 am on Feb 28, 2003 (gmt 0)

very nice g1smd, thank you :)

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / New To Web Development
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved