I have tested almost all 15 different pop-out scripts that work on all mobile devices. The following script is best for me and works perfectly on the Galaxy S3, but annoying pop-over on the Galaxy S5 requires any action on the screen of the screen so that it does not interfere with the current page Be opened in the background. In this script I must be different from the fact that it behaves differently on the basis of the Android device running on the Android device. Can anyone help edit this javascript code, so it is pop-down on all Android browsers, not something?
Here is the code:
var puShown = false; Var popewuth = 1370; Var pohhite = 800; Var Popfocus = 0; Var _Top = null; Function GetWindowHeight () {var myHeight = 0; If (typef (_Top.window.innerHeight) == 'number') {myHeight = _Top.window.innerHeight; } And if (_Top.document.documentElement & amp; _Top.document.documentElement.clientHeight) {myHeight = _Top.document.documentElement.clientHeight; } And if (_Top.document.body & amp; _Top.document.body.clientHeight) {myHeight = _Top.document.body.clientHeight; } Make my return; } GetWindowWidth () {var myWidth = 0; If (typef (_Top.window.innerWidth) == 'number') {myWidth = _Top.window.innerWidth; } And if (_Top.document.documentElement & amp; _Top.document.documentElement.clientWidth) {myWidth = _Top.document.documentElement.clientWidth; } And if (_Top.document.body & amp; _Top.document.body.clientWidth) {myWidth = _Top.document.body.clientWidth; } My wedding with; } GetWindowTop () {return (_Top.window.screenTop! = Undefined) function? _Top.window.screenTop: _Top.window.screenY; } GetWindowLeft () {return (_Top.window.screenLeft! = Undefined) function? _Top.window.screenLeft: _Top.window.screenX; } Function doOpen (url) {var About: "blank" var popid = "ad_" + Math.floor (89999999 * Math.Randem (+ 10000000); var pxLeft = 0; var pxTop = 0; PxLeft = (GetWindowLyft () + (GetWindowWidth) / 2) - (POPTuth / 2); PxTop = (GetWindowTop () + (GetWindowHyight () / 2) - (Pohhot / 2); if (puShown == true) { Return true;} Var PopWin = _Top.window.open (popURL, popID, 'toolbar = 0, scrollbar = 1, location = 1, status editor = 1, menubar = 0, resizable = 1, top =' + pxTop + ', Left = '+ PxLeft +', width = '+ PopWidth +', height = '+ pohhot); If PopWin {Pusa = true; if (popfocus == 0} {PopWin.blur (); If (navigator. UserAgent.toLowerCase (). IndexOf ("applewebkit") & gt; -1) {_Top. Window.blur (); _Top.window.focus ();}} PopWin.Init = function (e) {with (e) {param = e.pam; main = task () {if (typeof window.mozPaintCount! = "Undefined") {var x = window.open ("About: blank"); x.close ();} Var popURL = Try the .pop URL; {Opener.window.focus ();} Hold (error) {} window.location = popURL; } Main(); }}; PopWin.Params = {Popup: url} PopWin.Init (PopWin); } Return popup; } Function set cookie (name, value, time) {end of new = new date (); Expires.setTime (expires.getTime (+) + time); Document.cookie = name + '=' + value + '; Path = /, '+'; Ends = '+ expires.toGMTString (); } GetCookie function (name) {var cookies = document.cookie.toString (). Split (';'); Var cookie, c_name, c_value; (Cookie = cookies [n] .split ('='); c_name = cookie [0]; c_value = cookie [1]; if for (n = l; (C_name == name) {return c_value;}} return tap;} function initPu () {_Top = self; if (top! = Self) {try {if (top.document.location.toString ()) _Top = top ;} Hold (error) {}} if (document.attachEvent) {document.attachEvent ('onclick', checkTarget);} and if (document.addEventListener) {document.addEventListener ('click', check target, wrong) ;}} Function checkTarget (e) {if (cookie! ('Popund')) {var e = e || window.event; Var win = doOpen ('http://www.mediamoby.com/4g9s0hc8/') ; Set cookie ('popup', 1, 24 * 60 * 60 * 1000);}} InitPu ();
No comments:
Post a Comment