Current location: Hot Scripts Forums » General Web Coding » JavaScript » Bookmark this page...


Bookmark this page...

Reply
  #1 (permalink)  
Old 01-30-06, 05:12 AM
enchen's Avatar
enchen enchen is offline
Newbie Coder
 
Join Date: Apr 2005
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Bookmark this page...

I'm using this little function to create page bookmarks for various browsers:

Code:
<script language="javascript" type="text/javascript">
function CreateBookmark() {
if( window.sidebar && window.sidebar.addPanel ) {
    //Gecko (Netscape 6 etc.) - add to Sidebar
    window.sidebar.addPanel( this.title, this.href, '' );
} else if( window.external && ( navigator.platform == 'Win32' ||
      ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) ) {
    //IE Win32 or iCab - checking for AddFavorite produces errors in
    //IE for no good reason, so I use a platform and browser detect.
    //adds the current page page as a favourite; if this is unwanted,
    //simply write the desired page in here instead of 'location.href'
    window.external.AddFavorite( location.href, document.title );
} else if( window.opera && window.print ) {
    //Opera 6+ - add as sidebar panel to Hotlist
    return true;
} else if( document.layers ) {
    //NS4 & Escape - tell them how to add a bookmark quickly
    window.alert( 'Please click OK then press Ctrl+D to create a bookmark' );
} else {
    //other browsers - tell them to add a bookmark (adds current page, not target page)
    window.alert( 'Please use your browser\'s bookmarking facility to create a bookmark' );
}
return false;
}
</script>
My question is. Is it possible to make Firefox only bookmarking the page without also including it in the sidebar???
__________________
Today is tomorrow, yesterday...
Reply With Quote
  #2 (permalink)  
Old 01-30-06, 05:51 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
No idea, but if there isn't a method designed specifically to do that, it's not likely.
I personally hate these kind of scripts. They are just as annoying as spam and popups (since they usually appear as a popup asking if this site should be added as a favourite).
I hope you don't run this script onLoad or otherwise automatically!
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Reply With Quote
  #3 (permalink)  
Old 01-30-06, 06:00 AM
enchen's Avatar
enchen enchen is offline
Newbie Coder
 
Join Date: Apr 2005
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
No popup or onLoad, just a simple link like this:

<a href="http://www.example.com" title="My page" rel="sidebar" onclick="javascript:CreateBookmark()">Bookmark this page</a>

Just thought it would be nice to have the link displayed on the page...
__________________
Today is tomorrow, yesterday...
Reply With Quote
  #4 (permalink)  
Old 01-30-06, 06:11 PM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
Ah ok. Will keep this thread in mind if I come across a solution to your problem.
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Reply With Quote
  #5 (permalink)  
Old 01-31-06, 02:58 AM
enchen's Avatar
enchen enchen is offline
Newbie Coder
 
Join Date: Apr 2005
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks TwoD!

If anyone else got a solution please share
__________________
Today is tomorrow, yesterday...
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Classified Ads skipper23 Perl 3 11-22-05 02:22 AM
Passing a variable to another page tapir PHP 8 02-16-05 05:38 PM
need help creating an update & confirm page mikewooten PHP 1 11-08-04 04:28 PM
page browsing problem mivec PHP 3 04-17-04 03:43 AM
Classified Ads skipper23 Perl 2 12-30-03 03:43 AM


All times are GMT -5. The time now is 11:03 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.