Today I facing a strange problem. -
window.open(url,'_blank');
-
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 ..............
is not working for Tab System Browsers.
Please help.
Kind regards,
Dmjpro.
18 3678 gits 5,390
Expert Mod 4TB
heya dmjpro,
you have to set the width and height: - window.open('www.google.com','_blank', 'width=200,height=200');
kind regards
heya dmjpro,
you have to set the width and height: - 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.
gits 5,390
Expert Mod 4TB
can you give an example for the problem?
kind regards
can you give an example for the problem?
kind regards
Ok.
Have a look at this. -
function test()
-
{
-
try{
-
var win_array = new Array();
-
for(var i=0;i<10;i++){
-
win_array[i] = window.open('','_blank','height=200,width=200');
-
win_array[i].document.title = 'test________'+(i+1);
-
}
-
var win_num = Math.round(Math.random()*10);
-
win_array[win_num-1].focus();
-
}catch(e){alert(e.description);}
-
}
-
As a result it always gets focus on the last window.
Please help.
Kind regards,
Dmjpro.
don't get me wrong djmpro - var win_num = Math.round(Math.random()*10);
-
win_array[win_num-1].focus();
but [win_num-1] can sometimes give value of -1
gits 5,390
Expert Mod 4TB
hmmm ...
i tried something ... have a look at the following example, may be it helps: - // open a window and hold a ref
-
var t = window.open('http://www.google.de','test', 'width=200,height=200');
-
-
// create a callback that gets the t-ref
-
var cb = function(t) {
-
t.opener.focus();
-
};
-
-
// call the cb
-
cb(t);
kind regards
don't get me wrong djmpro - var win_num = Math.round(Math.random()*10);
-
win_array[win_num-1].focus();
but [win_num-1] can sometimes give value of -1
Sorry!
It will be...... -
win_array[win_num!=0?win_num-1:win_num].focus();
-
Kind regards,
Dmjpro.
hmmm ...
i tried something ... have a look at the following example, may be it helps: - // open a window and hold a ref
-
var t = window.open('http://www.google.de','test', 'width=200,height=200');
-
-
// create a callback that gets the t-ref
-
var cb = function(t) {
-
t.opener.focus();
-
};
-
-
// call the cb
-
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.
gits 5,390
Expert Mod 4TB
hi ...
this works analogue, with a small adaption ... simply pass the win-ref to focus to the the cb: - var t = window.open('http://www.google.de','test', 'width=200,height=200');
-
-
var t1 = window.open('http://www.google.de','test1', 'width=200,height=200');
-
-
var cb = function(win) { win.focus(); };
-
-
cb(t);
kind regards
hi ...
this works analogue, with a small adaption ... simply pass the win-ref to focus to the the cb: - var t = window.open('http://www.google.de','test', 'width=200,height=200');
-
-
var t1 = window.open('http://www.google.de','test1', 'width=200,height=200');
-
-
var cb = function(win) { win.focus(); };
-
-
cb(t);
kind regards
Thanks for your reply!
I tried this .......... -
<html>
-
<head>
-
<script language = "JavaScript">
-
function test()
-
{
-
try{
-
var win_array = new Array();
-
for(var i=0;i<5;i++){
-
win_array[i] = window.open('','_blank','height=200,width=200');
-
win_array[i].document.title = 'test________'+(i+1);
-
}
-
var win_num = Math.round(Math.random()*5);
-
//win_array[win_num-1].focus();
-
getFocus(win_array[win_num!=0?win_num-1:win_num]);
-
}catch(e){alert(e.description);}
-
}
-
function getFocus(win)
-
{
-
win.focus();
-
}
-
</script>
-
</head>
-
<body onload = test()>
-
</body>
-
</html>
-
but found not working.
Please Help!
Kind regards,
Dmjpro.
gits 5,390
Expert Mod 4TB
hi ...
i looked over it ... the following is working. forget about the cb and so on ... ;) i like to use cbs everywhere ... but you don't need ... - var win_array = [];
-
for(var i=0; i < 3; i++){
-
win_array[i] = window.open('http://www.google.com',
-
'_blank','height=200,width=200');
-
win_array[i].document.title = 'test________'+(i+1);
-
}
-
-
var win_num = Math.round(Math.random()*3);
-
var w_ref = win_array[win_num !=0 ? win_num-1 : win_num];
-
-
w_ref.focus();
kind regards
gits 5,390
Expert Mod 4TB
i changed the thread title to better describe the content ... since it is going in two directions now ...
kind regards
hi ...
i looked over it ... the following is working. forget about the cb and so on ... ;) i like to use cbs everywhere ... but you don't need ... - var win_array = [];
-
for(var i=0; i < 3; i++){
-
win_array[i] = window.open('http://www.google.com',
-
'_blank','height=200,width=200');
-
win_array[i].document.title = 'test________'+(i+1);
-
}
-
-
var win_num = Math.round(Math.random()*3);
-
var w_ref = win_array[win_num !=0 ? win_num-1 : win_num];
-
-
w_ref.focus();
kind regards
Again failed.
But what I think you changed nothing.
I trying in Mozilla. var win_array = [] this does not work in IE.
I think var win_array = new Array() works in Most Browsers.
But I still finding out the solution.
It works fine in IE but not in IE.
Please help me again.
Kind regards,
Dmjpro.
gits 5,390
Expert Mod 4TB
hi ...
i changed your last code here: - getFocus(win_array[win_num!=0?win_num-1:win_num]);
and my last code worked in Firefox ... definitly!
which IE? test the following in the address-bar of IE: - javascript:var i = [];alert(typeof i);
in case you get object - it works ... IE6 did it!
kind regards
hi ...
i changed your last code here: - getFocus(win_array[win_num!=0?win_num-1:win_num]);
and my last code worked in Firefox ... definitly!
But it does not work for me.
which IE? test the following in the address-bar of IE: - javascript:var i = [];alert(typeof i);
in case you get object - it works ... IE6 did it!
kind regards
Yeah!
Sorry...it works in IE.
Kind regards,
Dmjpro.
gits 5,390
Expert Mod 4TB
... test again with my working code and use: -
var w_ref = win_array[0];
-
instead of: -
var w_ref = win_array[win_num !=0 ? win_num-1 : win_num];
-
the first opened popup should be focused. is it?
kind regards
... test again with my working code and use: -
var w_ref = win_array[0];
-
instead of: -
var w_ref = win_array[win_num !=0 ? win_num-1 : win_num];
-
the first opened popup should be focused. is it?
kind regards
Na!
It's not working.
Please help.
Kind regards,
Dmjpro.
gits 5,390
Expert Mod 4TB
hmmm ... i don't get it ... ;( ... when started from the html-page it will not work ... when i start it from the firebug-console it does ... strange problem indeed ...
Post your reply Sign in to post your reply or Sign up for a free account.
Similar topics
2 posts
views
Thread by venkatesh |
last post: by
|
4 posts
views
Thread by Dan Cruz |
last post: by
|
3 posts
views
Thread by NeverLift |
last post: by
|
23 posts
views
Thread by Markus |
last post: by
|
13 posts
views
Thread by ldan |
last post: by
|
4 posts
views
Thread by Csaba Gabor |
last post: by
|
13 posts
views
Thread by tochiromifune |
last post: by
|
7 posts
views
Thread by anthony.turcotte |
last post: by
|
19 posts
views
Thread by Sonnich |
last post: by
|
4 posts
views
Thread by Alexey |
last post: by
| | | | | | | | | | |