Random URL redirect from array

前端 未结 8 1405
刺人心
刺人心 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:06

    Get a random URL from the array, and redirect ?

    if ( acceptedWebsites.indexOf(document.location.href) == -1 ) {
        var url = acceptedWebsites[Math.floor(Math.random()*acceptedWebsites.length)];
        document.location.href = url;
    }
    

提交回复
热议问题