Browser Tabs

I have created an browser.menus.onClicked.addListener and when I click it I runs browser.tabs.create({url: "context_menu_add_item.html"});

How can I pass data over to the new tab? Basically I want to pass over selected text.
Any help would be greatly appreciated?

The new tab is an extension page?

I assume the selected text is too unpredictable to add to the URL (e.g., page.html#selectedText) and access using location.hash.

What I generally do is have the new page request data from the background page during loading or retrieve it from storage.

In your onClicked event handler, you can save menuInfo.selectionText in a global variable or in local storage.

I’m not a professional developer, so what I do isn’t necessarily the best thing to do!