我知道這個問題已被問了很多次,但我仍然不能得到這個工作。我認爲這將有助於某人根據我的情況提出解決方案。如何防止iframe在Chrome中緩存?
我有一個從數組生成一個隨機視頻隨機video.php頁面,此工作正常,並在Chrome不會緩存:
<?php
$array = [
"http://www.mentor-distribution.com/media/Introducing_MConnect.mp4",
"http://www.mentor-distribution.com/media/hs_freedom_chair.mp4",
\t "http://www.mentor-distribution.com/media/quickstand.mp4",
\t "http://www.mentor-distribution.com/media/MFlex.mp4"
];
$randomIndex = array_rand($array);
$random = $array[$randomIndex];
?>
<iframe width="320" height="187" frameborder="0" allowfullscreen src="<?php echo htmlspecialchars($random); ?>"></iframe>
這是款嘗試每次顯示隨機視頻的html頁面,但是一旦加載它,直到您清除緩存後纔會更改視頻:
<div class="rightsidevid"><iframe width="320" height="187" src="http://mentor-distribution.com/internal/random-video.php" frameborder="0" scrolling="no" allowfullscreen></iframe></div>
如果有人能幫助它,將不勝感激。我確信你可以通過在網址的末尾添加一個數字來實現這一點(例如url?RandomGenNumber),但我不知道如何做到這一點。