首先说一下业务需求:
需要在当前各主流浏览器上从tab标签形式弹出一个页面,尽量不要以单独窗口弹出。
下面是网上搜集并修改、验证后的js代码,以备以后参阅。
function getUnionCookie(B) {var A = new RegExp(B + "=([^;]+)"), _ = A.exec(document.cookie), $ = "";if (_ != null) {try {$ = decodeURI(_[1]);}catch (C) {}}return $;
}function setUnionCookie(sName, sValue, oExpires, sPath) {document.cookie = sName + "=" + escape(sValue) + ";expires=" + oExpires.toUTCString() + ";path=" + sPath;
}//使用cookie控制每隔24小时弹一次,似乎不见效
function updateunionli() {var exp2 = new Date();exp2.setTime(exp2.getTime() + 24 * 60 * 60 * 1000);setUnionCookie("unionli_lc", 4 + 1, exp2, '/');var poped_statist = new Image();poped_statist.src = "http://www.anmeiqi.com/logo/anmeiqi.gif"; //广告的统计的url
}var anmeiqi_url = 'http://www.anmeiqi.com/';//要推广的url
var is_unionli_poped = getUnionCookie('unionlipop');
if (!is_unionli_poped) {var unionli_pidx = getUnionCookie('unionli_lc');if (!unionli_pidx)unionli_pidx = 1;(function() {var aa_url = window.anmeiqi_url;var _has2ap = 0;var ua = navigator.userAgent;var browser = {ie: /msie/i.test(ua),ie6: /msie 6/i.test(ua),ie7: /msie 7/i.test(ua),ie8: /msie 8/i.test(ua),ie9: /msie 9/i.test(ua),360: /360se/i.test(ua),sogou: /;?se.+?MetaSr/i.test(ua),maxthon: /Maxthon/i.test(ua),tt: /TencentTraveler/i.test(ua),ff: /firefox/i.test(ua),webkit: /AppleWebKit/i.test(ua),opera: /Opera/i.test(ua),qqbrowser: /QQBrowser/i.test(ua),theworld: /Theworld/i.test(ua)};function ev_op(e, event, func, act) {if (browser.ie)e[act === undefined ? 'attachEvent' : 'detachEvent']('on' + event, func);elsee[act === undefined ? 'addEventListener' : 'removeEventListener'](event, func, false)}//弹窗效果顶层包装函数function pop(url, param) {if (!document.body) {return setTimeout(function() {pop(url, param)}, 13)}try {if (browser['webkit'] && browser['maxthon']) {if (!core_pop(url)) {a_pop(url)}} else if (browser['tt']) {try {object_pop(url)} catch (e) {a_pop(url)}} else if (browser['sogou']) {if (!core_pop(url)) {a_pop(url)}} else if (browser['webkit'] && browser['qqbrowser']) {if (!core_pop(url)) {click_pop(url)}} else if (browser['webkit'] || browser['opera']) {a_pop(url)} else if (browser['theworld'] && browser.ie6) {if (!object_pop2(url)) {a_pop(url)}} else if (browser['theworld'] && browser.ie8) {if (!core_pop(url)) {try {object_pop(url)} catch (e) {click_pop(url)}}} else if (browser.ie6) {if (!core_pop(url)) {object_pop2(url)}} else if (browser.ie8) {if (!core_pop(url)) {document.onclick = function() {core_pop(url);document.onclick = null}}} else if (browser['ie']) {try {object_pop(url)} catch (e) {click_pop(url)}} else if (browser['ff']) {if (!core_pop(url)) {click_pop(url)}} else {if (!core_pop(url)) {click_pop(url)}}_has2ap = 1;updateunionli()} catch (e) {if (browser.ie7 || browser.ie8 || browser.ie9 || browser['qqbrowser']) {click_pop(url)} else {a_pop(url)}_has2ap = 1;updateunionli()}}function append(e) {for (var t in {body: 1}) {var ele = document.getElementsByTagName(t);for (var i = 0; i < ele.length; i++) {ele[i].insertBefore(e, ele[i].firstChild);return}}}function object_pop(url, param) {var object = document.createElement('object');object.setAttribute('classid', 'CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6');object.style.cssText = 'position:absolute;left:1px;top:1px;width:1px;height:1px;';append(object);object.launchURL(url)}function object_pop2(url, param) {var object2 = document.createElement('object');object2.setAttribute('classid', 'clsid:2D360201-FFF5-11d1-8D03-00A0C959BC0A');object2.style.cssText = 'position:absolute;left:1px;top:1px;width:1px;height:1px;';append(object2);for (var i in object2) {try {(function(o) {})(object2[i])} catch (e) {}}setTimeout(function() {object2.DOM.Script.open(url, '_blank', '')}, 500)}//监视到mouseup事件后异步取消,然后弹窗function click_pop(url, param) {ev_op(document, 'mouseup', function(e) {e = e || window.event;e.canceBubble = true;ev_op(document, 'mouseup', arguments.callee, true);core_pop(url, param)})}function a_pop(url) {var a = document.createElement('a');a.href = url;a.target = '_blank';var div = document.createElement('div');div.style.backgroundColor = '#ffffff';a.style.filter = 'alpha(opacity=0)';a.style.opacity = '0';a.appendChild(div);append(a);a.style.display = 'block';a.style.cursor = 'default';a.style.position = 'absolute';a.style.left = '0px';a.style.top = '0px';a.style.zIndex = 999999;var i = setInterval(function() {var d = document.documentElement || document.body;a.style.top = Math.max(document.documentElement.scrollTop, document.body.scrollTop) + 'px';div.style.width = Math.min(d.clientWidth, d.scrollWidth) + 'px';div.style.height = d.clientHeight + 'px'}, 200);a.onclick = function(e) {setTimeout(function() {a.parentNode.removeChild(a)}, 200);clearInterval(i)};a.onmouseup = function(e) {e = e || window.event;e.canceBubble = true}}function core_pop(url, param) {var w = window.open(url, '_blank', 'left=0,top=0,toolbar=yes,location=yes,' + 'status=yes,menubar=yes,scrollbars=yes,' + 'resizable=yes,width=' + screen.width + ',height=' + screen.height);return w}//调用弹窗函数入口setTimeout(function() {pop(aa_url, {a: 1,b: 2})}, 300);ev_op(window, 'beforeunload', function() {})})();
}
Python的WEB框架有Django、Tornado、Flask 等多种,Django相较与其他WEB框架其优势为:大而全,框架本身集成了ORM、模型绑定、模板引擎、缓存、Session等诸多功能。本文将以下方面带大家全面了解Django框架,笔者使用的版本为1.10.流程基本配置路由系统视图view模板Model中间件Form认证...
我知道这个错误已经被讨论了很多,但似乎每种情况都有不同的原因。我使用下面的代码和selenium从一个网站提取一些数据,并在第二次调用浏览器.get(url)。在import openpyxl, osfrom selenium import webdriveros.chdir('C://Users/user/Documents')os...
onReady(){// #ifdef H5// 初始化微信 let url = location.href.split("#")[0];configWxMp({debug: false,jsApiList: ["scanQRCode"],url: this.config.apiList.wxMpConfig,data: {ur...
wget -S "http:/192.168.0.102:8080/cache/lookup_url?url=http://www.dnion.com/"...
输入两个整数序列。其中一个序列表示栈的push顺序,判断另一个序列有没有可能是对应的pop顺序。为了简单起见,我们假设push序列的任意两个整数都是不相等的。 比如输入的push序列是1、2、3、4、5,那么4、5、3、2、1就有可能是一个pop系列。因为可以有如下的push和pop序列:push 1,push 2,push 3,...
#include
题目:表示数值的字符串 请实现一个函数用来判断字符串是否表示数值(包括整数和小数)。例如,字符串"+100"、"5e2"、"-123"、"3.1416"、"0123"及"-1E-16"都表示数值,但"12e"、"1a3.14"、"1.2.3"、"+-5"及"12e+5.4"都不是。 解题: 数值错误的形式有多种多样,但是正确的...
加法伺候 //超过20位数值相加---------------------------------------- function bigNumAdd(a, b) {if (!(typeof a === "string" && typeof b === "string")) return console.log("传入参数必...
业务场景: 从中文字句中匹配出指定的中文子字符串 .这样的情况我在工作中遇到非常多, 特梳理总结如下. 难点: 处理GBK和utf8之类的字符编码, 同时正则匹配Pattern中包含汉字,要汉字正常发挥作用,必须非常谨慎.推荐最好统一为utf8编码,如果不是这种最优情况,也有酌情处理. 往往一个具有普适性的正则表达式会简化程...
简单record 一下
#include