Mobile Bookmarklet

You can quickly and easily add bookmarks to your AllTheBookmarks account from any mobile device. Since you can't use extensions on mobile, you can log in from your mobile device and visit this page.

Below is a code snippet that you can copy, then create a new bookmark on your mobile device as you would normally. Before saving the bookmark, change the name to something simple like "ATB Bookmarker" and paste thiis code as the url.

Once you have the bookmarklet saved, you can simply go to your mobile bookmarks while on a page and this snippet will grab the info you need and add it to you account.

                javascript:(function() {
                    const apiKey = localStorage.getItem('notAnAuthToken');
                    const apiUrl = localStorage.getItem('api_url');
                    const name = prompt("Enter a name for the bookmark:");
                    const notes = prompt("Enter any notes (optional):");
                    const color = prompt("Enter a color (optional):");
                    const privacy = prompt("Enter privacy level (e.g., public/private):");
                    const folder = prompt("Enter a folder (optional):");
                    const url = window.location.href;
                
                    if (!apiKey) {
                        alert("You must sign in to obtain an auth token.");
                        return;
                    }
                
                    if (!name) {
                        alert("Name is required.");
                        return;
                    }
                
                    fetch(apiUrl + 'api/bookmarks/create', {
                        method: 'POST',
                        headers: {
                            'Content-Type': 'application/json',
                            'Authorization': `Bearer ${apiKey}`
                        },
                        body: JSON.stringify({ name, url, notes, color, privacy, folder })
                    })
                    .then(response => {
                        if (response.ok) {
                            alert("Bookmark saved successfully!");
                        } else {
                            alert("Failed to save bookmark. Please check your API key.");
                        }
                    })
                    .catch(error => {
                        console.error(error);
                        alert("An unknown error occurred while saving the bookmark.");
                    });
                })();