homepage Welcome to WebmasterWorld Guest from
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

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

there is this nice java script for bookmarking a site:

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>');
txt += " (Ctrl+D)";

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]



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

You could make that javascript external couldn't you?


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

how do i do this?


 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]


 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!


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

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


 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.


 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?


 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.


 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