![Firefox logo](https://assets-prod.sumo.prod.webservices.mozgcp.net/media/uploads/products/2020-04-14-08-36-13-8dda6f.png)
in JS, how to save a bookmark which can open in main, not sidebar?
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 !
Modified
All Replies (2)
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
It would be better to ask Firefox users to press Ctrl + D to bookmark the current link.