This is a bookmarklet you can use to save bookmarks from any browser directly into your Obsidian vault. It works because Obsidian supports a custom protocol obsidian:// which can be used to create new notes in your vault.

javascript: (function () {
  const title = document.title
  const file = title.replaceAll(/[^\w]/gi, "-").replaceAll(/[_-]+/g, "-")
  const filename = `Bookmarks/${file}`
  const selectedText = window.getSelection().toString()
  const url = document.location.href
  const content = `---${"\n"}type: bookmark${"\n"}url: ${url}${"\n"}---${"\n\n"}# ${title}
${selectedText != "" ? `${"\n"} > ${selectedText.replaceAll("\n", "\n> ")}` : ""}
${"\n\n"}
- [${title}](${url})
${"\n\n"}`
  document.location.href = `obsidian://new?file=${encodeURIComponent(filename)}&content=${encodeURIComponent(content)}`
})()

Parameters you can use in the final call to Obsidian:

  • name: Name of the new note
  • content: Contents of the new note
  • vault: The target vault