Connecting Tech Pros Worldwide Help | Site Map

openining a new window

Member
 
Join Date: Jun 2007
Posts: 47
#1: Jul 1 '08
ello everyone.

i want to open a link in a new window but without pop notification, means user does not have to select "allow pop-up" and also want to redirects to the other page.
here is code of the file go.php
Expand|Select|Wrap|Line Numbers
  1. $url;
  2. <script language="javascript">
  3. window.open('<?php echo $url; ?>');
  4.  
  5. window.location='searchresults.php?keyword=<?php echo $keyword;?>&item_id=<?php echo $pid;?>';
  6. </script>
  7.  
I know by using window.open i will get a pop-up always. but i did tried different methods but none of them worked. like i tried to use form and called a javascript on onload but that too didn't worked.
remember this is part of an execution file. i want to redirect without clicking on any button or link.
i hope i put my query clearly.

Regards
Muddasir Hussain
Needs Regular Fix
 
Join Date: Mar 2008
Posts: 311
#2: Jul 1 '08

re: openining a new window


Why would you believe that what you wish to do is even possible? The changes in browsers which, depending on the settings, requires a user to confirm in order for the popup to appear were made to protect the user from unwanted popups. But it sounds like you wish to somehow override this with your PHP and Javascript? I would not imagine you could do this.
hsriat's Avatar
Expert
 
Join Date: Jan 2008
Location: Bath, UK
Posts: 1,609
#3: Jul 1 '08

re: openining a new window


Well, there is a way to bypass the most of the popup blockers. But I would not recommend that to use. As it would just annoy the user, which I never want should happen.
So you better let it be blocked.

Regards
pbmods's Avatar
Site Moderator
 
Join Date: Apr 2007
Location: Texas
Posts: 5,435
#4: Jul 1 '08

re: openining a new window


Heya, Muddasir.

Does your pop-up need to be modeless?

Try using Lightbox to display a modal div over your page content using JavaScript (http://www.huddletogether.com/projects/lightbox/).
Member
 
Join Date: Jun 2007
Posts: 47
#5: Jul 2 '08

re: openining a new window


i am able to do what i want to..
i guess i wasnt clear in putting my query to u ppl.

i used
parent.opener.location.reload();
which refresh the parent window while new window is being opened using <form> with target=_blank

neways thanks a lot for u guyz for always helping me. i have learned a lot through Bytes


Regards
Muddasir Hussain
Needs Regular Fix
 
Join Date: Mar 2008
Posts: 311
#6: Jul 2 '08

re: openining a new window


Ah, ok, I think I see what you are getting at.

In my application, I sometimes have the main window open up a popupwindow, and then that popwindow may open up a second popupwindow when the user clicks a button. And sometimes I get this popup warning for the second popupwindow even though I do not get it for the first popup (because my site is considered safe enough).

And the reason is because I am opening up the second popup window from the first popup window. If, instead, I delegate the opening of the second window to a Javascript function on the main page, I do not get this problem. Because now it is the main window that is opening up the popup. I think this is what the OP is referring to. And I do this by placing all the Javascript for opening up popups on the main page, and then calling them from Javascript in the popup using the "opener" keyword.
Reply