473,835 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

open new popup windows and focus a certain one

dmjpro
2,476 Top Contributor
Today I facing a strange problem.

Expand|Select|Wrap|Line Numbers
  1. window.open(url,'_blank');
  2.  
It opens a separate window in IE but in others where new Tab in same window allowed, is not working.
I mean it opens in different Tab but in same Window.
How can i make this in separate window?
One more thing ..............
Expand|Select|Wrap|Line Numbers
  1. window.focus();
is not working for Tab System Browsers.
Please help.

Kind regards,
Dmjpro.
Sep 11 '07 #1
18 3841
gits
5,390 Recognized Expert Moderator Expert
heya dmjpro,

you have to set the width and height:

Expand|Select|Wrap|Line Numbers
  1. window.open('www.google.com','_blank', 'width=200,height=200');
kind regards
Sep 11 '07 #2
dmjpro
2,476 Top Contributor
heya dmjpro,

you have to set the width and height:

Expand|Select|Wrap|Line Numbers
  1. window.open('www.google.com','_blank', 'width=200,height=200');
kind regards
Hey Gits, Thanks for your reply.
It is working fine but i want to focus particular window.
As I found it works in IE fine but in others not.
Please help.

Kind regards,
Dmjpro.
Sep 11 '07 #3
gits
5,390 Recognized Expert Moderator Expert
can you give an example for the problem?

kind regards
Sep 11 '07 #4
dmjpro
2,476 Top Contributor
can you give an example for the problem?

kind regards
Ok.
Have a look at this.

Expand|Select|Wrap|Line Numbers
  1. function test()
  2.             {
  3.             try{
  4.                 var win_array = new Array();
  5.                 for(var i=0;i<10;i++){
  6.                 win_array[i] = window.open('','_blank','height=200,width=200');
  7.                 win_array[i].document.title = 'test________'+(i+1);
  8.                 }
  9.                 var win_num = Math.round(Math.random()*10);
  10.                 win_array[win_num-1].focus();
  11.                 }catch(e){alert(e.description);}
  12.             }
  13.  
As a result it always gets focus on the last window.
Please help.

Kind regards,
Dmjpro.
Sep 11 '07 #5
rohitchawla
85 New Member
don't get me wrong djmpro

Expand|Select|Wrap|Line Numbers
  1. var win_num = Math.round(Math.random()*10);
  2. win_array[win_num-1].focus();
but [win_num-1] can sometimes give value of -1
Sep 11 '07 #6
gits
5,390 Recognized Expert Moderator Expert
hmmm ...

i tried something ... have a look at the following example, may be it helps:

Expand|Select|Wrap|Line Numbers
  1. // open a window and hold a ref
  2. var t = window.open('http://www.google.de','test', 'width=200,height=200'); 
  3.  
  4. // create a callback that gets the t-ref
  5. var cb = function(t) {
  6.     t.opener.focus();
  7. };
  8.  
  9. // call the cb
  10. cb(t);
kind regards
Sep 11 '07 #7
dmjpro
2,476 Top Contributor
don't get me wrong djmpro

Expand|Select|Wrap|Line Numbers
  1. var win_num = Math.round(Math.random()*10);
  2. win_array[win_num-1].focus();
but [win_num-1] can sometimes give value of -1
Sorry!
It will be......
Expand|Select|Wrap|Line Numbers
  1. win_array[win_num!=0?win_num-1:win_num].focus();
  2.  
Kind regards,
Dmjpro.
Sep 11 '07 #8
dmjpro
2,476 Top Contributor
hmmm ...

i tried something ... have a look at the following example, may be it helps:

Expand|Select|Wrap|Line Numbers
  1. // open a window and hold a ref
  2. var t = window.open('http://www.google.de','test', 'width=200,height=200'); 
  3.  
  4. // create a callback that gets the t-ref
  5. var cb = function(t) {
  6.     t.opener.focus();
  7. };
  8.  
  9. // call the cb
  10. cb(t);
kind regards
Thanks for your reply!
But I want any window to be focused.
Your code only makes Opener window to be focused.
This is not my Objective.
Please Help.

Kind regards,
Dmjpro.
Sep 11 '07 #9
gits
5,390 Recognized Expert Moderator Expert
hi ...

this works analogue, with a small adaption ... simply pass the win-ref to focus to the the cb:

Expand|Select|Wrap|Line Numbers
  1. var t = window.open('http://www.google.de','test', 'width=200,height=200'); 
  2.  
  3. var t1 = window.open('http://www.google.de','test1', 'width=200,height=200'); 
  4.  
  5. var cb = function(win) { win.focus(); }; 
  6.  
  7. cb(t);
kind regards
Sep 11 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
4139
by: venkatesh | last post by:
Hi Members, I have used the below mentioned code to open a html page in a new browser. The window size is 200 x 300. In that browser, I've given code to open another browser of the same size. However, this is not happening in IE 5. Can anyone help me solve this problem? Code: Script:
4
2209
by: Dan Cruz | last post by:
Below are two files: Main.asp and Help.asp. I've stripped it down to the 'barest-of bones' so that anyone willing to help can duplicate the problem on their own systems. ***Main.asp*** looks like so: <HTML> <HEAD> <TITLE>Main</TITLE>
3
24723
by: NeverLift | last post by:
But, if it's not open, I don't want to open it . . . using window.open will open it if it doesn't exist, even if the url in that open is null (the window is then empty -- but it's open). The situation is: A main window opens child windows one at a time as the user requests, each with its own name. The user may click in any child window or the main window to open a summary window, which has a name all windows know. I want to get that...
23
6424
by: Markus | last post by:
Hi, i have this problem: Sometimes, i can't reproduce, if i click on an small image on the website, the popup _AND_ an other Tab in firefox open. Here are the linkcode: <div align="center">
13
6269
by: ldan | last post by:
Hi everybody, I would not consider myself an expert in javascript - but so far whatever I know, helped me reaching my goals. Recently I started to experience a lot of javascript errors related to opening up a popup window in an application I wrote. The error messages are quite diverse: "Object doesn't support this property or method" or "Unspecified error." or "The callee (server ) is not available and disappeared; all connections are...
4
3610
by: Csaba Gabor | last post by:
Up until a few weeks ago, javascript code like window.open("http://mydomain.com", "windowName"); would always bring my new or reused window to the top, with focus. Lately, Firefox (Deer park alpha 2) only brings it to the top if the window is new. If it's being reused, the window does not come to the foreground (with IE 6 it does). Is there a new way in Mozilla/Firefox that I can ensure that this
13
22182
by: tochiromifune | last post by:
Hello The window.open method brings my window to the top only if it is new. If it's being reused, the window does not come to the foreground (with IE 6 it does). Is there a new way in Mozilla/Firefox that I can ensure that this window comes to the top? Thank you for your help
7
3683
by: anthony.turcotte | last post by:
Hi, I've looked for a solution to this problem on google, read posts in this newsgroup and I still haven't found anything that could help me. Here's the scenario. 1. User accesses pageA.html 2. User clicks on menu link to open popup.html 3. pageA.html checks if popup.html is already open. It is not, open
19
4243
by: Sonnich | last post by:
Hi! I have used JS, but I am still new to it. I have something like this: oNewWindow = new Object(); oNewWindow = open("sonnich.xls","Qopen","resizable=yes,scroll=yes, status=yes, width=320px, height=470px",true); oNewWindow.focus();
4
2137
by: Alexey | last post by:
I have a situation where I need to respond to a link click by opening 2 windows and navigating to a URL in the parent window. Here's the function I invoke: function handleOfferLink(selfURL, instructionURL, offerURL) { window.open(selfURL, '_self').focus(); window.open(offerURL, '_blank').focus(); window.open(instructionURL, '_blank', 'width=435,height=390,top=0,left=0').focus();
0
10815
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10524
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10562
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9348
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7768
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6968
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5805
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4434
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3092
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.