this post was submitted on 19 Jan 2025
11 points (100.0% liked)
Firefox
18252 readers
59 users here now
A place to discuss the news and latest developments on the open-source browser Firefox
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
How exactly are you trying to run your javascript? Website javascript certainly won't be allowed to create bookmarks. If you run the function on browser side however, then it should work fine - but then I don't understand why it's wrapped into javascript url.
If it's a javascript: url because you tried to run this as bookmark itself (ie. clicking this special bookmark creates another bookmark folder and a bookmark inside it) then that's not going to work because that's pretty much just user provided code running in website context.
Hello, I tried pasting that into the URL bar But firefox autoremoves the "javascript:" in front. When I type it manually still, it does nothing.
So I pressed F12, went to console tab and pasted it there
It fails with "Uncaught (in promise) ReferenceError: PlacesUtils is not defined"
Here is a human readable version of this command
I'm just trying to create a bookmark with a script, so I can create the 40 or so special bookmarks with search keywords that I want, without wiping all the bookmarks like an import would. Also I want to just automate this for my OS re-installation.
F12 opens web developer tools - the console there runs scripts in the website context - you cannot use that to access browser internals like PlacesUtils.
You need to run your script via browser console, I can't remember a hotkey for it, but you can find it from menu > more tools... > browser console
Also, I'm not sure but there's a chance that browser console is "read-only" in release firefox - meaning you might not be able to run anything from it. If that is the case, then open normal web developer tools (F12) and go to its settings, there's some checkbox there to enable "browser chrome debugging" or something like that. After checking that (and reopening browser console) you can run your function from browser console.