Random URL redirect from array

前端 未结 8 1230
刺人心
刺人心 2021-01-27 05:37

/** * Political Animals * contentscript.js is loaded on each page(s) listed in manifest.json * This plugin replaces all the images on the website of news sites with pic

8条回答
  •  情话喂你
    2021-01-27 06:08

    The basic jist of the logic would be...

    var acceptedWebsites = ['http://www.cnn.com/', 'www.nytimes.com', 'www.latimes.com', 'http://www.washingtonpost.com/', 'http://www.nbcnews.com/', 'http://www.foxnews.com/'];
    
    var randomLink = Math.floor(Math.random() * acceptedWebsites.length);
    
    window.location = acceptedWebsites[randomLink];
    

提交回复
热议问题