Try to use the target node's window instead of just resorting to the most recent browser window