As far as I can tell, you are actually loading the website in the sidebar (check "Download this bookmark in the sidebar"). If so, and if the sidebar opens the page of the main window. You can use window.postMessage to communicate between them. But, as I said, the sidebar page should open the main page, because you need a link to the window to post a message.
sidebar.js
var newwin = window.open('http://otherpage')
newwin.onload = function()
{
newwin.postMessage('Hey newwin', 'http://sidebar');
};
mainpage.js
window.addEventListener('message',function(e)
{
if(message.origin == 'http://sidebar')
alert('message from sidebar');
},false);
Using this, you still do not have access to the document, but you can link between them and the script with any changes you want to make.
: , , DOM. var newwin = window.open('blah'); newwin.document postMessage .