PDA

View Full Version : bookmark script



brian northmore
11-22-2007, 07:38 PM
1) Script Title:
bookmarksite
2) Script URL (on DD):
"javascript:bookmarksite"
3) Describe problem:

I am enclosing the script I copied to see if you can help. When I try to run it I get an error on page as described:

<html>

<head>

<script type="text/javascript">
/***********************************************
* Bookmark site script- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

/* Modified to support Opera (v9 tested) */
function bookmarksite(title,url){
if (window.sidebar) // firefox
window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
var elem = document.createElement('a');
elem.setAttribute('href',url);
elem.setAttribute('title',title);
elem.setAttribute('rel','sidebar');
elem.click();
}
else if(document.all)// ie
window.external.AddFavorite(url, title);
}
</script>
</head>

<body>
<a href="javascript:bookmarksite('Yahoo', 'http://www.yahoo.com');">Bookmark Yahoo</a>
</body>
</html>

<!--

*******************************************

I set up a simple html file to test the bookmark before using it on my site, but I am getting the following error:

Line: 24
Char: 2
Error: Object doesn't support this propertty or method
Code: 0
URL file: //etc

I am using windows Vista basic edition

**********************************************

-->

jscheuer1
11-22-2007, 07:48 PM
Some of the IE extended functions are blocked in Vista, but it might be just that this works live and not locally. Did you test your page on the server, or just on your hard drive? Does the demo page on Dynamic Drive for this script work for you?

brian northmore
11-23-2007, 07:51 PM
i only tried it locally but thanks i'll give it a go.

yes the demo does work so i think you have solved it for me - thanks