Enjoy an ad free experience by logging in. Not a member yet?
Register .
02-25-2012, 05:19 PM
PM User |
#1
New to the CF scene
Join Date: Feb 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
window.open Help!
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
02-25-2012, 05:25 PM
PM User |
#2
Supreme Master coder!
Join Date: Jun 2002
Location: London, England
Posts: 17,036
Thanks: 197
Thanked 2,411 Times in 2,389 Posts
As you say, all modern browsers will block unrequested popups.
You could do something like
Code:
<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
__________________
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Last edited by Philip M; 02-25-2012 at 05:29 PM ..
02-25-2012, 05:31 PM
PM User |
#3
New to the CF scene
Join Date: Feb 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by
Philip M
As you say, all modern browsers will block unrequested popups.
You could do something like
Code:
<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.....?
02-25-2012, 05:35 PM
PM User |
#4
Supreme Master coder!
Join Date: Jun 2002
Location: London, England
Posts: 17,036
Thanks: 197
Thanked 2,411 Times in 2,389 Posts
Quote:
Originally Posted by
dr1
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.
__________________
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
02-25-2012, 05:40 PM
PM User |
#5
New to the CF scene
Join Date: Feb 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by
Philip M
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
02-25-2012, 06:53 PM
PM User |
#6
Supreme Master coder!
Join Date: Jun 2002
Location: London, England
Posts: 17,036
Thanks: 197
Thanked 2,411 Times in 2,389 Posts
Quote:
Originally Posted by
dr1
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.
__________________
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Users who have thanked Philip M for this post:
02-25-2012, 07:51 PM
PM User |
#7
New to the CF scene
Join Date: Feb 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by
Philip M
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?
Jump To Top of Thread
Thread Tools
Rate This Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT +1. The time now is 03:24 PM .
Advertisement
Log in to turn off these ads.