first thing there are 3 functions we will use:

function setCookie(c_name, value, exdays) {
            var exdate = new Date();
            exdate.setDate(exdate.getDate() + exdays);
            var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
            document.cookie = c_name + "=" + c_value;
        }
  
    function getCookie(c_name) {
        var i, x, y, ARRcookies = document.cookie.split(";");
        for (i = 0; i < ARRcookies.length; i++) {
            x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
            y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
            x = x.replace(/^\s+|\s+$/g, "");
            if (x == c_name) {
                return unescape(y);
            }
        }
    }
  
    function DeleteCookie(name) {
            document.cookie = name + '=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
        }

  Now we will start with the page load:

$(window).load(function () {
 //if IsRefresh cookie exists
 var IsRefresh = getCookie("IsRefresh");
 if (IsRefresh != null && IsRefresh != "") {
    //cookie exists then you refreshed this page(F5, reload button or right click and reload)
    //SOME CODE
    DeleteCookie("IsRefresh");
 }
 else {
    //cookie doesnt exists then you landed on this page
    //SOME CODE
    setCookie("IsRefresh", "true", 1);
 }
})

  

Jquery detect page refresh的更多相关文章

  1. Part 31 AngularJS page refresh problem

    What is the issue : When you navigate to http://localhost/students, you will see list of students as ...

  2. jQuery - Detect value change on hidden input field

    You can simply use the below function, You can also change the type element. $("input[type=hidd ...

  3. 使用 jQuery 调用 ASP.NET AJAX Page Method

    文章来源:http://chungle.iteye.com/blog/406054 说到轻量级的客户端通信,我注意到大多数人喜欢使用 ASP.NET AJAX Page Method 多于 ASMX ...

  4. 转载:10+ handy and reusable jQuery code snippets

    源地址:http://www.catswhocode.com/blog/10-handy-and-reusable-jquery-code-snippets Smooth scrolling to t ...

  5. jQuery Mobile 脚本加载问题

    刚开始使用jQuery Mobile,发现很多问题需要重新考虑,比如脚本加载问题. 在普通html中,如果a.html中有链接到b.html,b.html中有类似代码: $(document).rea ...

  6. jquery插件 源码

    下面是对Jquery几个经常用到的地方进行的增强. 功能是参考百度七巧板JS框架来完成的. 一.页面属性 $.page.getHeight():获取页面高度 $.page.getWidth():获取页 ...

  7. [转]Load ASP.NET MVC Partial Views Dynamically Using jQuery

    本文转自:http://www.binaryintellect.net/articles/218ca630-ba50-48fe-af6e-6f754b5894aa.aspx Most of the t ...

  8. jQuery Ajax Post Data Example

    http://www.formget.com/jquery-post-data/ jQuery Ajax Post Data Example Fugo Of FormGet jQuery $.post ...

  9. 【转】2014年25款最好的jQuery插件

    2014年25款最好的jQuery插件 来源:Specs' Blog-就爱PHP   时间:2014-12-30 10:24:10   阅读数:2267 分享到: 0 http://www.php10 ...

随机推荐

  1. spring cloud 之 Eureka 知识点

    Eureka原理 当服务消费者想要调用服务提供者的API时,首先会在注册中心中查询当前可用的实例的网络地址(也可能是定时查询可用实例,本地缓存好可用服务列表),然后再使用客户端负载均衡,命中到其中一个 ...

  2. echarts 知识点

    echarts map 禁止放大缩小,设置 calculable 为 false 即可. calculable: false echarts 报错: There is a chart instance ...

  3. mysql explicit_defaults_for_timestamp参数

    在mysql中:- timestamp列如果没有显式定义为null,默认会被设置为not null属性.(其它的数据类型如果没有显式定义为not null,默认是可以为null的).设置timesta ...

  4. (文章转载)织梦CMS判断不同的栏目显示不同的图片

    {dede:php} $thisid = $refObj->Fields['id']; $row = $dsql->GetOne("Select typeid From `ybs ...

  5. ios获取安装的app

    http://www.iphonedevsdk.com/forum/iphone-sdk-development/22289-possible-retrieve-these-information.h ...

  6. 关于lidroid xUtils 开源项目

    最近搜了一些框架供初学者学习,比较了一下XUtils是目前git上比较活跃 功能比较完善的一个框架,是基于afinal开发的,比afinal稳定性提高了不少,下面是介绍: xUtils简介 xUtil ...

  7. 异步FIFO跨时钟域亚稳态如何解决?

    跨时钟域的问题:前一篇已经提到要通过比较读写指针来判断产生读空和写满信号,但是读指针是属于读时钟域的,写指针是属于写时钟域的,而异步FIFO的读写时钟域不同,是异步的,要是将读时钟域的读指针与写时钟域 ...

  8. vs2017 编译JRTPLIB

    一. JRTPLIB简介 RTP 是目前解决流媒体实时传输问题的最好办法,而JRTPLIB是一个用C++语言实现的RTP库,它完全遵循RFC 1889设计,目前已经可以运行在Windows.Linux ...

  9. 实验十一 C的指针

    指针编程 11.1 #include<stdio.h> int main() { ]={,,,,,,,,,},i,*p,sum=; ],i=;i<;i++,p++) { ==) su ...

  10. selenium除错

    1.使用命令行启动selenium 下载selenium jar包 http://selenium-release.storage.googleapis.com/index.html 此处下载的是se ...