I am working on a feature that every time windown.open() is triggered, it will open a new tab. Here is my code, there is the error of Cannot read property \'document\' of null