简体   繁体   English

JavaScript仅在刷新页面多次后才能工作

[英]JavaScript only working after Refreshing Page multiple times

My JavaScript only starts working when I refresh my page multiple times. 仅当我多次刷新页面时,我的JavaScript才能开始工作。

Please check out the following code - 请检查以下代码-

<div class="col-xs-6 col-sm-3  js--isotope-target  js--cat-2" data-price="14.36" data-rating="4">
  <div class="products__single">
<figure class="products__image">
  <a href="single-product.html">
    <img alt="#" class="product__image" width="263" height="334" src="images/dummy/w263/2.jpg">
  </a>
  <div class="product-overlay">
    <a class="product-overlay__more" href="single-product.html">
      <span class="glyphicon glyphicon-search"></span>
    </a>

    <div class="product-overlay__stock">
      <span class="in-stock">&bull;</span> <span class="in-stock--text">In stock</span>
    </div>
  </div>
</figure>
<div class="row">
  <div class="col-xs-9">
    <h5 class="products__title">
      <a class="products__link  js--isotope-title" href="single-product.html">Moringa Powder</a>
    </h5>
     </div>
    </div>
    <div class="products__category">
  Powders
    </div>
   </div>
  </div>

I had tried resetting the browser Javacript (Disabling then Enabling it again) but nothing worked, The JavaScript never works the first the page is loaded, I have to always Refresh the page multiple times to get the javascript working! 我曾尝试重置浏览器Javacript(禁用然后再次启用它),但没有任何效果,在页面首次加载后JavaScript永远无法工作,我必须始终刷新页面多次才能使javascript工作!

add ver to your JavaScript file. 将ver添加到您的JavaScript文件。 like this. 像这样。 myjava.js to myjava.js?v=1.0 myjava.js到myjava.js?v = 1.0

every time change the ver. 每次更改版本。 if any changes in your .js file. .js文件中是否有任何更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM