(function(){ var proxyIframe = null; var proxyUrl = ""; try{ proxyUrl = document.getElementById("uc-proxy").getAttribute("src"); proxyUrl = proxyUrl.slice(0, proxyUrl.lastIndexOf("/"))+"/proxy.html"; }catch(e){ } var body = window.document.body; var docEle = window.document.documentElement; /** * 获取浏览器名称 */ function browserName() { var ua = navigator.userAgent.toLowerCase(), // userAgent regMsie = /.*(msie) ([\w.]+).*/, // ie regFirefox = /.*(firefox)\/([\w.]+).*/, // firefox regOpera = /(opera).+version\/([\w.]+)/, // opera regChrome = /.*(chrome)\/([\w.]+).*/, // chrome regSafari = /.*version\/([\w.]+).*(safari).*/;// safari var browserMatch = regMsie.exec(ua) || regFirefox.exec(ua) || regOpera.exec(ua) || regChrome.exec(ua) || null; if(browserMatch != null) { return browserMatch[1] || ""; } else { browserMatch = regSafari.exec(ua) || null; if(browserMatch != null) { return browserMatch[2] || ""; } } return ""; } var body = window.document.body, docEle = window.document.documentElement, browser_name = browserName(); /** * 获取网页内容高度 * @returns */ function getContentHeight(){ try{ //return Math.max(docEle.scrollHeight,docEle.clientHeight,body.scrollHeight,body.clientHeight); if(browser_name == "chrome"||browser_name == "safari") { return docEle.scrollHeight; } else { return Math.max(body.scrollHeight,body.clientHeight) + 20; } }catch(e){ return body.clientHeight + 20; } }; function _exeProxyCommand(hash){ //如果没有添加代理iframe则需要先把iframe加入到内容页面中 if(proxyIframe != null){ body.removeChild(proxyIframe); proxyIframe = null; } proxyIframe = document.createElement("iframe"); proxyIframe.id = "uc_proxyIframe"; proxyIframe.width = "0px"; proxyIframe.style.display = "none"; body.appendChild(proxyIframe); var d = new Date(); proxyIframe.src = proxyUrl+"?t="+d.getTime()+hash; } window.exeProxyCommand = function() { var arg_len = arguments.length; if(arg_len <= 0) return false; var param = ""; for(var i=0; i