Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-25-2012, 05:19 PM   PM User | #1
dr1
New to the CF scene

 
Join Date: Feb 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
dr1 is an unknown quantity at this point
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
dr1 is offline   Reply With Quote
Old 02-25-2012, 05:25 PM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,036
Thanks: 197
Thanked 2,411 Times in 2,389 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
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..
Philip M is online now   Reply With Quote
Old 02-25-2012, 05:31 PM   PM User | #3
dr1
New to the CF scene

 
Join Date: Feb 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
dr1 is an unknown quantity at this point
Quote:
Originally Posted by Philip M View Post
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.....?
dr1 is offline   Reply With Quote
Old 02-25-2012, 05:35 PM   PM User | #4
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,036
Thanks: 197
Thanked 2,411 Times in 2,389 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by dr1 View Post
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.
Philip M is online now   Reply With Quote
Old 02-25-2012, 05:40 PM   PM User | #5
dr1
New to the CF scene

 
Join Date: Feb 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
dr1 is an unknown quantity at this point
Quote:
Originally Posted by Philip M View Post
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
dr1 is offline   Reply With Quote
Old 02-25-2012, 06:53 PM   PM User | #6
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,036
Thanks: 197
Thanked 2,411 Times in 2,389 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Quote:
Originally Posted by dr1 View Post
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.
Philip M is online now   Reply With Quote
Users who have thanked Philip M for this post:
dr1 (02-25-2012)
Old 02-25-2012, 07:51 PM   PM User | #7
dr1
New to the CF scene

 
Join Date: Feb 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
dr1 is an unknown quantity at this point
Quote:
Originally Posted by Philip M View Post
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?
dr1 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:24 PM.


Advertisement
Log in to turn off these ads.