js调用android本地java代码 当在Android上使用WebView控件开发一个Web应用时,可以创建一个通过Javascript调用Android端java代码的接口.也就是可以通过Javascript代码来调用Android本地的java代码! 下面来说明一下这个接口的具体创建方法. 第一步:首先需要在Android侧的java代码中创建实现了具体功能的类.(注意:作为接口的方法必须要加@JavascriptInterface注解)比如: public class WebAppIn…
使用服务端与本地的时间差进行计算 $(function(){ // 倒计时 var _ordertimer = null; var data =new Date(); var txt = $('.js_time_txt'); var buyTime = '2018/03/28 10:30:00'; //开抢时间 var nowTime = '2018/03/16 17:00:00'; //接口返回当前时间 var dateDiff = new Date(nowTime) - new Date(g…
本例子以vue语法伪代码书写: 1,获取服务端北京时间 getRealTime() { let that = this; var xhr = new XMLHttpRequest(); if( !xhr ){ xhr = new ActiveXObject("Microsoft.XMLHTTP"); } xhr.open("HEAD",location.href,true); xhr.onreadystatechange=function(){ if( xhr.re…
WebSocket服务端 C#示例代码 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net.Sockets; using System.Net; using System.Threading; using System.Text.RegularExpressions; using System.Security.Cryptography; na…