博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
前端方案解决思路
阅读量:6984 次
发布时间:2019-06-27

本文共 2895 字,大约阅读时间需要 9 分钟。

hot3.png

HTML5 Cross Browser Polyfills

via:

表单重复提交

对于各种情况(没有耐心的用户,鼠标失灵,软件系统问题...)所引起的表单重复提交问题 可以综合以下两个方案来处理

##debounce && throttle

&& 有相关的方法/函数

解释1:

解释2:

PS: 这两个节流的方法/函数也可以作用于

  • "输入校验"
  • "输入字数限制显示"
  • "输入自动匹配"
  • window.onresize
  • window.onscroll

##disabled && show loading tip

参考

获取服务器时间

转自: IMWeb 前端公众群 -- 深圳-离层

$.ajax({  type: 'HEAD',  url : window.location.href,  complete:function(r){    console.log(new Date(r.getResponseHeader('Date')).toString());  }});

Ajax Request - jQuery vs native

Detect IE or Edge

via:

via:

/**  * detect IE  * returns version of IE or false, if browser is not Internet Explorer  * http://stackoverflow.com/questions/19999388/check-if-user-is-using-ie-with-jquery  */function detectIE() {    var ua = window.navigator.userAgent;    var msie = ua.indexOf('MSIE ');    if (msie > 0) {        // IE 10 or older => return version number        return parseInt(ua.substring(msie + 5, ua.indexOf('.', msie)), 10);    }    var trident = ua.indexOf('Trident/');    if (trident > 0) {        // IE 11 => return version number        var rv = ua.indexOf('rv:');        return parseInt(ua.substring(rv + 3, ua.indexOf('.', rv)), 10);    }    var edge = ua.indexOf('Edge/');    if (edge > 0) {        // IE 12 => return version number        return parseInt(ua.substring(edge + 5, ua.indexOf('.', edge)), 10);    }    // other browser    return false;}

Get Parameters from script tag attributes

via:

// document.currentScript = document.currentScript || (function() {  var scripts = document.getElementsByTagName('script');  return scripts[scripts.length - 1];})();document.currentScript.getAttribute('one'); //1document.currentScript.getAttribute('two'); //2

Countdown

via:

// Our countdown plugin takes a callback, a duration, and an optional message$.fn.countdown = function (callback, duration, message) {    // If no message is provided, we use an empty string    message = message || "";    // Get reference to container, and set initial content    var container = $(this[0]).html(duration + message);    // Get reference to the interval doing the countdown    var countdown = setInterval(function () {        // If seconds remain        if (--duration) {            // Update our container's message            container.html(duration + message);        // Otherwise        } else {            // Clear the countdown interval            clearInterval(countdown);            // And fire the callback passing our container as `this`            callback.call(container);           }    // Run interval every 1000ms (1 second)    }, 1000);};// Use p.countdown as container, pass redirect, duration, and optional message$(".countdown").countdown(redirect, 5, "s remaining");// Function to be called after 5 secondsfunction redirect () {    this.html("Done counting, redirecting.");    window.location = "http://msdn.microsoft.com";}

關於 IFRAME

via:

转载于:https://my.oschina.net/keywindy/blog/523629

你可能感兴趣的文章
《中国人工智能学会通讯》——8.25 基于演化优化的生物网络配准
查看>>
飞鹤乳业CIO:移动化让企业品牌和消费者紧密连接
查看>>
教你编写Node.js中间件,实现服务端缓存
查看>>
美国税局再遭攻击:原是偷来的社会安全号码作祟
查看>>
六大技巧提升员工信息安全意识
查看>>
保利协鑫多晶硅产量再创历史记录
查看>>
爱屋及乌 年轻投资者因喜爱Snapchat亏钱也买Snap股票
查看>>
物联网产品背后潜藏着危机
查看>>
阿里云将增设马来西亚数据中心 中国技术获赞
查看>>
与Netflix合作 美电视运营商推出4K频道
查看>>
Struts2中的Action
查看>>
Balluff推出刀具识别系统
查看>>
美国支付巨头Verifone遭遇网络攻击
查看>>
开平推进智慧城市等领域信息化建设及公共数据资源共享
查看>>
宜兴电信成功跨界合作开拓农村物联网市场
查看>>
Oracle业务适合用PostgreSQL去O的一些评判标准
查看>>
多个常见代码设计缺陷
查看>>
今年光伏市场规模可达30GW 分布式有望占据三分江山
查看>>
因新漏洞问题 Firefox 49发布时间将延期一周
查看>>
WLAN产品形态之分层架构
查看>>