Created
May 22, 2012 17:01
-
-
Save apphp-snippets/2770274 to your computer and use it in GitHub Desktop.
Most today's web browsers like Firefox (Ctrl+D), Opera (Ctrl+T) and IE (Ctrl+D) provide a keyboard shortcuts to enable users bookmark their favorite pages. But if you want to provide your visitors with a "Bookmark this page" link they can click you may us
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| /* Source: http://www.apphp.com/index.php?snippet=php-get-remote-ip-address */ | |
| function CreateBookmarkLink(){ | |
| var title = document.title; | |
| var url = document.location.href; | |
| 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("Press Control + D to bookmark"); | |
| return true; | |
| }else{ | |
| /* Other */ | |
| alert("Press Control + D to bookmark"); | |
| } | |
| } | |
| </script> | |
| <a href="javascript:CreateBookmarkLink();">Add to Favorites/Bookmark</a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment