Extensión de Chrome: pasar variables a una ventana emergente

I'm trying to create an etension for Google Chrome. I am monitoring page text selection and i want the popup page to recieve the selected text when i click on the popup button.

Is there a way to pass variables to a popup? I understand, that messging doen't work for closed popups, so what should i do?

preguntado el 27 de agosto de 11 a las 20:08

2 Respuestas

Once a text is selected send it to a background page where you would store it in lets say textSelection global variable. Once popup is opened you can access this variable with:

var selection = chrome.extension.getBackgroundPage().textSelection;

(you can access any variable and function from a background page directly, without requests)

Respondido 28 ago 11, 00:08

Your question can't be concisely answered, but I recommend you look here and read through some of the code samples:


Respondido 28 ago 11, 00:08

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.