Fix window.open return undefined

Fix this problem when content scripts do not have any access to a page's global window object.
A link explaining this technique would be better.