[removed] url containing random number

前端 未结 4 1482
自闭症患者
自闭症患者 2020-12-19 05:02

A friend is linking my page from his site. As I need users to avoid caching when visiting my page, I want the url to have this form:

http://www.mypage.com/index.php?

4条回答
  •  无人及你
    2020-12-19 05:42

    var lower = 0;
    var upper = 100000000;
    var url = "http://www.mypage.com/index.php?"+(Math.floor(Math.random()*(upper-lower))+lower)
    

    it generates a random X from 0(lower) to 100000000 (upper), you can obv set the bounds you want ;)

提交回复
热议问题