Popup window blur

Hi!

I’m heaving problems with popup window blur, basically i want popup window to stay under main window for my users.
I have regular popup script that opens window


function writeConsole(content) {

 	var wobj = window.open('','test',

	'width=250,height=250'

	+',menubar=no'

	+',toolbar=no'

	+',status=no'

	+',scrollbars=no'

	+',resizable=no'

	+',location=no'

	+',left=20'

	+',top=450');


	if (wobj != null)

	{

	  wobj.document.writeln(

	   '<html><head><title>sex.it</title><style>* {padding:0; margin: 0;}</style><script type="text/javascript">setTimeout("window.opener.focus()", 2250);window.onload = function(){ window.opener.focus(); }</script></head>'

	    +'<body bgcolor=white>'

	    + content

	    +'</body></html>'

	  )



	

	}

}

I’m calling this function when page loads.
Now this is working when timeout is rather hight 2250 if i lower it to lets say 50 than it’s not working. I guess it has to wait for browser to finish loading stuff. This code works for IE, FF3 but on Chrome and Firefox 4 i can’t get this thing running. And i have seen sites, porn :slight_smile: doing this on all browsers but i can’t extract the code :frowning: can someone help pls

The following might help in regard to pop-under windows.
http://www.codeave.com/javascript/code.asp?u_log=7068

I understand behaviour but that’s not working. Well it’s working on IE and FF3 but on FF4 and chrome that’s not working i simply can’t tell window to go under main window.

And also that example from your link is not working …

If it’ working on some web browsers and others, quite possibly the web browser itself does not allow that behaviour to occur.

Here is the script that does the job!


$.popunder = function(content, title) {

            var _parent = self;

            var bPopunder = !($.browser.mozilla && $.browser.version >= '2.0');



            if (top != self) {

                try {

                    if (top.document.location.toString()) {

                        _parent = top;

                    }

                }

                catch(err) { }

            }



            /* create popunder dummy*/

            var popunder = _parent.window.open('about:blank', '', 'toolbar=0, scrollbars=1, location=1, statusbar=1, menubar=0, resizable=1, height = 100, width= 100');

	    popunder.document.writeln('<html><head><title>' + title +'</title><style>* {padding:0; margin: 0;}</style></head><body bgcolor=white>' + content   +'</body></html>'

	    );

            if (popunder) {

                popunder.blur();

                if (bPopunder) {

                    /* classic popunder, should work on webkit*/

                    _parent.window.blur();

                    _parent.window.focus();

                    try { opener.window.focus(); }

                    catch (err) { }

                }

                else {

                    /* popunder for e.g. ff4 */

                    popunder.init = function(e) {

                        with (e) {

                            (function() {

                                if (typeof window.mozPaintCount != 'undefined') {

                                    var x = window.open('about:blank');

                                    x.close();

                                }



                                try { opener.window.focus(); }

                                catch (err) { }

                            })();

                        }

                    };

                    popunder.init(popunder);

                }

            }



            return this;

        }

With Google Chrome no popunder occurs. Instead the web browser says that the popup has been blocked. My Firefox says that it blocked it too.

Internet Explorer loaded the popunder page, but the script on Internet Explorer then set my Google Chrome window to the page that’s visible. That’s impressive.

How about Safari - nope. It says that it blocked things too.
I don’t have Opera installed on here, but I doubt things will improve there too.

Dare I say it, but I don’t think that the script is ready for prime-time yet.

Sure it’s blocked, every popup is by default blocked on chrome and firefox (that much i can say 100%) when you allow it (like every normal popup window in the world - you should know this stuff) it does the job. Maybe it’s not ready completely but it does the job and it’s a good start for everyone else, much better than your first advice.