dual moniter setup using java script

Hi
I have a requriement, ther would be two screens. one scrren is to fill the application form and the other screen is for doumentaion used for  filling  the form . instead of pressing ALT Tab every time, we want to use the dual monter setup using java script.
please help to fix this one.
 Thanks in advance
onanarAsked:
Who is Participating?
 
StealthyDevCommented:
You cannot achieve this using JavaScript or anyother browser scripting.
It can be alternatively achieved by changing the X,Y position of top and left of the second / first monitor.

You can find more in here:
http://stackoverflow.com/questions/57652/how-do-i-get-javascript-to-open-a-popup-window-on-the-current-monitor

Regards.
P.S.: As long as you know the x and y position that falls on the particular monitor you can do:
var x = 0;
var y = 0;
var myWin = window.open(''+self.location,'mywin','left='+x+',top='+y+',width=500,height=500,toolbar=1,resizable=0');

Open in new window

0
 
onanarAuthor Commented:
Thanks for ur reply. so where i need to tell this? i belive k this is java script which has mentioned in ur refferd link, can i achive by  using this ?

function getMouseXY( e ) {
    if ( event.clientX ) { // Grab the x-y pos.s if browser is IE.
        CurrentLeft = event.clientX + document.body.scrollLeft;
        CurrentTop  = event.clientY + document.body.scrollTop;
    }
    else {  // Grab the x-y pos.s if browser isn't IE.
        CurrentLeft = e.pageX;
        CurrentTop  = e.pageY;
    }  
    if ( CurrentLeft < 0 ) { CurrentLeft = 0; };
    if ( CurrentTop  < 0 ) { CurrentTop  = 0; };  
 
    return true;
}
0
 
onanarAuthor Commented:
please find my below code


Case I:
Code:
var left = (screen.width-250);
win1 =  window.open('C:\\data\\TestDualMonitor\\A1.html','A1','width=650,height=850,left='+left+',top=0,scrollbars=yes');
win2 = window.open('C:\\data\\TestDualMonitor\\A2.html','A2','width=650,height=850,left=0,top=0,scrollbars=yes');
Dual Monitor:
-      window 1 will appear in between two monitors, users can drag to any location .
-      window 2 on monitor 1, top left corner
 

Single Monitor:  
      - Both the windows are available in single monitor

Case II:
var left = (screen.width+500);
win1 = window.open('C:\\data\\TestDualMonitor\\A1.html','A1','width=650,height=850,left='+left+',top=0,scrollbars=yes');
win2 = window.open('C:\\data\\TestDualMonitor\\A2.html','A2','width=650,height=850,left=0,top=0,scrollbars=yes');
 

Single Monitor:
-      Window 1 is not visible, But the window is available on the task bar.




Note: In dual monitor screen, screen.width gives only the width of the primary monitor.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
StealthyDevCommented:
After using the attached function, you will get the full width of the monitor. ie, monitor1.width+monitor2.width

so you can easily find it is single monitor or dual.

Please run the below code and find the value of CurrentLeft and CurrentTop.

Regards.
function getMouseXY( e ) {
    if ( event.clientX ) { // Grab the x-y pos.s if browser is IE.
        CurrentLeft = event.clientX + document.body.scrollLeft;
        CurrentTop  = event.clientY + document.body.scrollTop;
    }
    else {  // Grab the x-y pos.s if browser isn't IE.
        CurrentLeft = e.pageX;
        CurrentTop  = e.pageY;
    }  
    if ( CurrentLeft < 0 ) { CurrentLeft = 0; };
    if ( CurrentTop  < 0 ) { CurrentTop  = 0; };  
 
    return true;
}

Open in new window

0
 
onanarAuthor Commented:
please correct me if i am wrong..i am using IE

function getMouseXY( e ) {
    if ( event.clientX ) { // Grab the x-y pos.s if browser is IE.
        CurrentLeft = event.clientX + document.body.scrollLeft;
        CurrentTop  = event.clientY + document.body.scrollTop;
    }

i will have to use CurrentLeft  in my window .open() and CurrentTop as top.

my requirement.

I will get two popups-
1 st pop up should be displayed in first moniter
2 nd pop up should be displayed in second moniter.

please advice me
Thank in advance
0
 
onanarAuthor Commented:
Hi. The above function is not working. I am getting java script errors. will i need to change in the above code?
0
 
StealthyDevCommented:
Hi again!

Just execute the below page in both single monitor and dual monitor system.

Do come back to me with the values printed on the screen.

Regards.
<body onmousemove="return getMouseXY()">
</body>

<script>

var CurrentLeft = 0;
var CurrentTop = 0;

function getMouseXY( e ) {
    if ( event.clientX ) { // Grab the x-y pos.s if browser is IE.
        CurrentLeft = event.clientX + document.body.scrollLeft;
        CurrentTop  = event.clientY + document.body.scrollTop;
    }
    else {  // Grab the x-y pos.s if browser isn't IE.
        CurrentLeft = e.pageX;
        CurrentTop  = e.pageY;
    }  
    if ( CurrentLeft < 0 ) { CurrentLeft = 0; };
    if ( CurrentTop  < 0 ) { CurrentTop  = 0; };  
	document.write(CurrentLeft + ":" + CurrentTop);
 
    return true;
}

</script>

Open in new window

0
 
onanarAuthor Commented:
Thanks for your response. I am getting values like  917 : 29. but it keeps changing. you want me to add these values in to my win.open() height and width?
0
 
StealthyDevCommented:
Oh, screen.width is also no use..

Try screen.availWidth ?

Regards.
0
 
onanarAuthor Commented:
sorry . i could not understand . please tell me what i could do with these values?
0
 
StealthyDevCommented:
No, forget about the old script, I was wrong.
Now, I ask you to check what is the value of screen.availWidth...

And after googling reg. this, I came to know that, your requirement is not possible. ie., detecting dual monitor. (Using script lang. in a browser)

I can suggest you one thing:
* In your open window method you are naming windows as A1 and A2.
* After keeping the window in the right place (using case-I, after first open). It is possible to load the next pages in the same window with the same name.

Regards

P.S.: Finally, what you are looking for is not possible.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.