Safari extension variable storage

Hi, I am attempting to create my first Safari extension and a bit overwhelmed and confused. I want my extension to show a menu when the toolbar icon is pressed. Initially this menu will only have a "save" option, which when pressed will store the URLs of all of the tabs in that active window. The idea of this is that when you are researching a topic and have a window open with several tabs and you know that you wont be coming back to them for a few days, this extension will save all of those tabs and you can then restore that entire window (with all of its tabs) in a few days time.

Trouble is, I don't know how to store the information. I would use the browserWindow.tabs array but I don't know where to store it. Do I need to use HTML local storage? Or do I allocate storage in a script in the global file? Once this information is stored, I will make it add an entry to the toolbar menu. Whent his entry is selected, the window and tabs will be restored.

The idea of this is that when you are researching a topic and have a window open with several tabs and you know that you wont be coming back to them for a few days, this extension will save all of those tabs and you can then restore that entire window (with all of its tabs) in a few days time.

I am using this in a situation where I have upwards of six tabs open in a window and want to save all of those tabs. If I use bookmarks I will I have to bookmark each of the tabs and then restore the tabs individually. I am trying to make something that does them all at once. Unless you can suggest a way to achieve that using bookmarks...?

I am using this in a situation where I have upwards of six tabs open in a window and want to save all of those tabs. If I use bookmarks I will I have to bookmark each of the tabs and then restore the tabs individually. I am trying to make something that does them all at once. Unless you can suggest a way to achieve that using bookmarks...?

Yes, I am aware of that option, however when it comes to restoring those tabs I am going to have to open a new window then open 11 new tabs within it and then in each of those tabs select the bookmark for it. I want a way of pressing one button and automatically loading those 11 tabs with their correct page.

I found an option to do this by going to the bookmarks menu >> favourites >> the desired folder >> then there is an open in tabs option. This will suffice I suppose but I was hoping for something like being able to right click on the bookmarks folder from the new window view where it shows the bookmarks icons (in Yosemite) and having an open in tabs option there. However nothing comes up with a right click there. This method is also a bit annoying if I want to update the tabs in the folder, i.e. if I have saved a set of tabs and then restore them later, and while I am working on them I open a couple of new tabs, I will either have to add the new tabs individually and manually, or go to manage bookmarks and delete the bookmarks folder so i can save a new one. A bit of fiddling there...

Yes, I am aware of that option, however when it comes to restoring those tabs I am going to have to open a new window then open 11 new tabs within it and then in each of those tabs select the bookmark for it.

Click to expand...

I understood the purpose of this from your first question, point is, I use this myself all, the, time. And unless this has changed in Yosemite, then restoring all those tabs is a one-click operation. What you need, is to use the browser bookmarks bar, not the menu. Then removing the folder is also only a question of dragging it off the bookmarks bar.

I understood the purpose of this from your first question, point is, I use this myself all, the, time. And unless this has changed in Yosemite, then restoring all those tabs is a one-click operation. What you need, is to use the browser bookmarks bar, not the menu. Then removing the folder is also only a question of dragging it off the bookmarks bar.

Click to expand...

Ahhhh I had assumed that Yosemite had dumped the bookmarks bar because it is hidden by default. I only just thought to try and reactivate it. Found it and it works pretty well for what I want. Saves me a lot of time trying to figure out how to make the extension!

MacRumors attracts a broad audience
of both consumers and professionals interested in
the latest technologies and products. We also boast an active community focused on
purchasing decisions and technical aspects of the iPhone, iPod, iPad, and Mac platforms.