Encapsulate window.open to make it more useful and more compatible. Many people say window.open is incompatible, but it is not, because it cannot be executed directly and must be triggered manually by the user; see the code:
The code is as follows
var openWindow = function(url, options) {var str = "";if (options) {options.height = options.height || 420;options.width = options.width || 550;options.left = options.left || ((screen.width - options.width) / 2); //Default is centered options.top = options.top || ((screen.height - options.height) / 2); //Default is centered for (var i in options) {str += ',' + i + '=' + options[i];}str = str.substr(1);};window.open(url, 'connect_window_'+ (+new Date), str);//parameter 1 is url, parameter 2 can repeatedly pop up str = null;};//demo 1: Open the new window to open my LED hit light power website document.body.onclick = function(){openWindow("http://www.daermay.com/ ?rel=xuexb");}//demo 2: Fixed width and centered document.body.onclick = function(){openWindow("//www.VeVB.COM/ ?rel=xuexb",{width:888});}