I want to create an add bookmark button in my website so that users can easily bookmark my page for future reference. So, I googled a bit and found a clean way which is using the browser.bookmarks
I am currently using vue (options API) for my website. Here is my code snippet for that -
methods: {
addBookmark() {
const bookmark = {title: 'My Book', url: 'www.bookkay.com'}
browser.bookmarks.create(bookmark)
}
}
However, I am getting error that browser object is not defined.

I believe this is because browser object is not available in the scope of vue methods.
So, pls feel free to share some workarounds for this problem. Either trying to get the browser object available in vue components methods scope or an alternative way to create bookmarks using javascript.