js navigator platform

原创
2018/08/31 17:58
阅读数 303
Object.defineProperty(navigator,'platform',{get:function(){return 'New-platform your want!';}});

你懂得。

var program = require('commander');
const Nightmare = require('nightmare');

let options = { 
                waitTimeout: 3 * 60 * 1000,
                gotoTimeout: 60 * 1000,
                pollInterval: 100, //in ms
                //openDevTools: {mode: 'detach'},
                show: true,
              };  

const nightmare = Nightmare(options);

nightmare
  .goto("https://www.baidu.com/")
  .evaluate(()=> { 
      //return document.title
      Object.defineProperty(navigator, "platform", {
          get: function() {return "Win32";}
      })  
      return navigator.platform;
  })  
  .end()
  .then(console.log)
  .catch((error)=> {
    console.log(error);
})

 

展开阅读全文
打赏
0
0 收藏
分享
加载中
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部