Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

in JS, how to save a bookmark which can open in main, not sidebar?

  • 2 replies
  • 11 have this problem
  • 12 views
  • Last reply by cor-el

more options

I did lots of search on the web. People have been struggling with this problem for many years.

The scenario:

My standard_weight.php takes height parameter either from $_GET or from $POST. The web page has a form to let users type in height.

Control-D can save the location, but not the height.

My page is too simple to ask users to create an account and save profile.

So I want to provide a link users can click and bookmark the current page with height.

<script language="JavaScript1.2" type="text/javascript">
 function CreateBookmarkLink() {

 title = "my ideal weight"; 
 height = function_to_get_current_height_value();
 url = "http://my.site.com/standard_weight.php?height=" + height ;

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); 
	} else if(window.opera && window.print) { // Opera Hotlist
		alert("Sorry, your browser doesn't support this function." );
	}
	return false ; 
 }

 if (window.external) {
  document.write('<a onClick ="javascript:CreateBookmarkLink();">Add to Favorites</a>'); 
  } else  if (window.sidebar) {
  document.write('<a onClick ="javascript:CreateBookmarkLink();">Bookmark Page</a>'); 
 } else if (window.opera && window.print) {	
   document.write('<a onClick ="javascript:CreateBookmarkLink();">Add Bookmark</a>');
 } 
</script>


When the link is clicked , a dialog will pop up and the user can save the bookmark.

The problem is that when the bookmark is opened, it is in sidebar. The bookmark property has the check for "Load this bookmark in the sidebar." Asking users to clear the check is not a friendly solution.

Is there anyway to get around this problem?

If you google this topic, you can find that people has been struggling with this for long time. I guess that they just end up with saying "sorry, your browser doesn't support this function." on Firefox.


Best wishes to Firefox !

I did lots of search on the web. People have been struggling with this problem for many years. The scenario: My standard_weight.php takes height parameter either from $_GET or from $POST. The web page has a form to let users type in height. Control-D can save the location, but not the height. My page is too simple to ask users to create an account and save profile. So I want to provide a link users can click and bookmark the current page with height. <pre><nowiki><script language="JavaScript1.2" type="text/javascript"> function CreateBookmarkLink() { title = "my ideal weight"; height = function_to_get_current_height_value(); url = "http://my.site.com/standard_weight.php?height=" + height ; if (window.sidebar) { // Mozilla Firefox Bookmark window.sidebar.addPanel(title, url,""); } else if( window.external ) { // IE Favorite window.external.AddFavorite( url, title); } else if(window.opera && window.print) { // Opera Hotlist alert("Sorry, your browser doesn't support this function." ); } return false ; } if (window.external) { document.write('<a onClick ="javascript:CreateBookmarkLink();">Add to Favorites</a>'); } else if (window.sidebar) { document.write('<a onClick ="javascript:CreateBookmarkLink();">Bookmark Page</a>'); } else if (window.opera && window.print) { document.write('<a onClick ="javascript:CreateBookmarkLink();">Add Bookmark</a>'); } </script> </nowiki></pre> When the link is clicked , a dialog will pop up and the user can save the bookmark. The problem is that when the bookmark is opened, it is in sidebar. The bookmark property has the check for "Load this bookmark in the sidebar." Asking users to clear the check is not a friendly solution. Is there anyway to get around this problem? If you google this topic, you can find that people has been struggling with this for long time. I guess that they just end up with saying "sorry, your browser doesn't support this function." on Firefox. Best wishes to Firefox !

Modified by cor-el

All Replies (2)

more options

There are two Bugs related to a feature like that; one was WONTFIX'd and the other is still open.
https://bugzilla.mozilla.org/show_bug.cgi?id=66248
https://bugzilla.mozilla.org/show_bug.cgi?id=214530

(Please don't comment in that Bug report unless you can provide a patch to fix the problem.) https://bugzilla.mozilla.org/page.cgi?id=etiquette.html

more options

It would be better to ask Firefox users to press Ctrl + D to bookmark the current link.