...

View Full Version : window.open Help!



dr1
02-25-2012, 05:19 PM
Hi I'm new here and need some help;

I spent so long with this and need either a miracle or a javascript expert!

I have the code below which is used to open up a chat window, the problem is all browser treat this as a pop up and block it!

What could be changed to get round this?

$chat = "window.open( '" . SK_Navigation::href("private_chat", array("userKey"=>$pr_key, "oppUserKey"=>$opp_key, 'is_esd_session'=>1 )) . "', '', 'height=540,width=415,left=100,top=100,scrollbars=no,resizable=no' );";

Thanks
dr

Philip M
02-25-2012, 05:25 PM
As you say, all modern browsers will block unrequested popups.

You could do something like


<div id='chatArea' style='border:1px solid #aaa; width:500px; height:400px; overflow:auto;'></div>

but I do not know how you would get it to display in accordance with your code.

It is your responsibility to die() if necessary….. - PHP Manual

dr1
02-25-2012, 05:31 PM
As you say, all modern browsers will block unrequested popups.

You could do something like


<div id='chatArea' style='border:1px solid #aaa; width:500px; height:400px; overflow:auto;'></div>

but I do not know how you would get it to display in accordance with your code.

It is your responsibility to die() if necessary….. - PHP Manual

Not sure I understand how? I know what a div is, and besides this really needs to open in a new page or tab, separate to the main page. any thoughts.....?

Philip M
02-25-2012, 05:35 PM
Not sure I understand how? I know what a div is, and besides this really needs to open in a new page or tab, separate to the main page. any thoughts.....?

It is for the user to decide whether to open a new window or a new tab. You cannot control it.

dr1
02-25-2012, 05:40 PM
It is for the user to decide whether to open a new window or a new tab. You cannot control it.

Yeah sure, but there's got to be away to get around the pop up window been block after all the user is requesting it. (By clicking on a button)

This code below manages to open without been blocked, so why not mine?

<a href="Http://www.yahoo.com" onclick="MyWindow=window.open('http://www.yahoo.com','MyWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no, resizable=no,width=600,height=300'); return false;">Click Here</a>

Someone suggested doing it via html and passing the variables that way... any ideas if that would work/ how to?

Thanks

Philip M
02-25-2012, 06:53 PM
This code below manages to open without been blocked, so why not mine?


Because your popup is unrequested. The user must deliberately click on the link (that is request) the Yahoo page.

dr1
02-25-2012, 07:51 PM
Because your popup is unrequested. The user must deliberately click on the link (that is request) the Yahoo page.

No, it's been requested by the user clicking on a button or should be, so how would I change the original code to make it work if user requested?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum