How do I override window.screen?

后端 未结 1 1595
青春惊慌失措
青春惊慌失措 2020-12-19 17:13

I\'m writing a simple PhantomJS app that scrapes particular pages looking for patterns. In one of these pages, the owner of the site is reading the window.screen

相关标签:
1条回答
  • 2020-12-19 17:26

    You can't set the window.screen values in the LoadStarted event, but you can in the Intialized event. So, instead, the code would look like this:

    tab.onInitialized = function () {
        tab.evaluate(function () {
            window.screen = {
                    width: 1920,
                    height: 1080
                };
        });
    };
    
    0 讨论(0)
提交回复
热议问题