473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Window.focus() (or window.print()) problem with XP/SP2 ?

Didn't get answer with google and in my regular forum. Came across this site and posting here. Your help will be highly appreciated !

Our application have frames - MainNav, TaskNave and Content. When print button is clicked, it prints only the Content (obviously top.Content.focus() is in the code before window.print()). We were using windows 2000 & IE6 for years. Recently, our installation updated users machines with XP SP2. Now when print button is clicked, all three frames get printed in 3 pages. Same application, if used from XP SP2, 3 pages gets printed where as when used from W2K, only 1 page is printed. I looked all over place, didn't find any information on focus not working correctly with XP SP2. I tried so many things but no luck. Please help!
MainNav.jsp
--
<TD><A tabIndex=-1 href=#><IMG SRC="<%= imagePath %>/images/button_print.gif" ALT="Print" onClick="if (window.print) { top.Content.focus(); window.print(); }" border="0"></A></TD>
--
frameset.jsp
--
<FRAMESET ROWS="134,*" border="0" onload="resetTimer();" onunload="exitAlertWindow();">
<FRAME ONREADYSTATECHANGE="hidepane();" NAME="MainNav" SRC="<%= commandPath %>/CSES/Main/displayMainNav" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no" FRAMEBORDER="0" NORESIZE TABINDEX="-1">
<FRAMESET COLS="180,588,*" border="0">
<FRAME ONREADYSTATECHANGE="hidepane();" NAME="TaskNav" SRC="<%= commandPath %>/CSES/Main/displayTaskNav" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="auto" class=TA FRAMEBORDER="0" NORESIZE TABINDEX="-1">
<FRAME ONREADYSTATECHANGE="hidepane();" NAME="Content" SRC="<%= commandPath %>/CSES/Main/displayWelcome<%= strMiscMessage %>" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="auto" FRAMEBORDER="0" NORESIZE>
<FRAME ONREADYSTATECHANGE="hidepane();" NAME="Blank" SRC="<%= imagePath %>/common/blankPage.html" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no" FRAMEBORDER="0" NORESIZE>
</FRAMESET>

Now what I found:

On onclick for print, when I change top.Content.focus(); to top.MainNav.focus() it does print only MainNav; if I change to top.TaskNav.focus() it prints only TaskNav, but when I change to top.Blank.focus(), this prints multiple pages just like top.Content.focus().

So what I know is focus() does work on other 2 frames, but not on Content and Blank with XP SP2. With W2K IE6, everything works fine.

Tried changing the name of Content to something else, still didn't work. The site is intranet.

Any one has any idea what might be the reason that this code broke in XP SP2. Thanks.
Mar 5 '07 #1
8 4040
pronerd
392 Expert 256MB
What is the status of the "Blank" frame when it is being printed? If its visiblity or other CSS attributes are set to make it not visible then this could be why it is printing the entire frameset instead of just that frame. i.e. IE might be trying to print that page, but when it goes there and sees there is nothing to print it assumes you must want to print the frameset content since there would be no point in trying to print a blank page.
Mar 5 '07 #2
Ok, blank is visible. The problem happens in both, Content and Blank. For both entire frameset is printed.
I tried few more things, and might be close - but still not there. Need your help.

1) I started playing with the frame order on frameset. Now when I put Blank at the left most, then TaskNav and then Content - and try focus on each of them on by one for printing - Now Blank printed correctly, TaskNav printed correctly but for Content every frames printed.

2) Changed order again, Now Blank, Content and TaskNav - This time all 3 printed correctly.

--> The conclusion I drawn is what ever frame is put after TaskNav, it cannot focus and print just that frame.

So something to do with TaskNav.jsp.

--> TaskNav.jsp is a long jsp with all the left menu items with their links. I made it a blank jsp with hardly anything in it. Now everything works fine, even the frames after the TaskNav.

Now I started putting the code in TaskNav.jsp one section of menu at a time, and test the print. I saw that after few sections, at one point it stops working. No matter what code I put. Is this has anything to do with the length of jsp??

Again the same code works fine with SP1 but XP/SP2 seems to have problem. Can you suggest anything I can try?

Thanks a lot.
Mar 5 '07 #3
sumittyagi
202 Expert 100+
Didn't get answer with google and in my regular forum. Came across this site and posting here. Your help will be highly appreciated !

Our application have frames - MainNav, TaskNave and Content. When print button is clicked, it prints only the Content (obviously top.Content.focus() is in the code before window.print()). We were using windows 2000 & IE6 for years. Recently, our installation updated users machines with XP SP2. Now when print button is clicked, all three frames get printed in 3 pages. Same application, if used from XP SP2, 3 pages gets printed where as when used from W2K, only 1 page is printed. I looked all over place, didn't find any information on focus not working correctly with XP SP2. I tried so many things but no luck. Please help!
MainNav.jsp
--
<TD><A tabIndex=-1 href=#><IMG SRC="<%= imagePath %>/images/button_print.gif" ALT="Print" onClick="if (window.print) { top.Content.focus(); window.print(); }" border="0"></A></TD>
--
frameset.jsp
--
<FRAMESET ROWS="134,*" border="0" onload="resetTimer();" onunload="exitAlertWindow();">
<FRAME ONREADYSTATECHANGE="hidepane();" NAME="MainNav" SRC="<%= commandPath %>/CSES/Main/displayMainNav" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no" FRAMEBORDER="0" NORESIZE TABINDEX="-1">
<FRAMESET COLS="180,588,*" border="0">
<FRAME ONREADYSTATECHANGE="hidepane();" NAME="TaskNav" SRC="<%= commandPath %>/CSES/Main/displayTaskNav" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="auto" class=TA FRAMEBORDER="0" NORESIZE TABINDEX="-1">
<FRAME ONREADYSTATECHANGE="hidepane();" NAME="Content" SRC="<%= commandPath %>/CSES/Main/displayWelcome<%= strMiscMessage %>" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="auto" FRAMEBORDER="0" NORESIZE>
<FRAME ONREADYSTATECHANGE="hidepane();" NAME="Blank" SRC="<%= imagePath %>/common/blankPage.html" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="no" FRAMEBORDER="0" NORESIZE>
</FRAMESET>

Now what I found:

On onclick for print, when I change top.Content.focus(); to top.MainNav.focus() it does print only MainNav; if I change to top.TaskNav.focus() it prints only TaskNav, but when I change to top.Blank.focus(), this prints multiple pages just like top.Content.focus().

So what I know is focus() does work on other 2 frames, but not on Content and Blank with XP SP2. With W2K IE6, everything works fine.

Tried changing the name of Content to something else, still didn't work. The site is intranet.

Any one has any idea what might be the reason that this code broke in XP SP2. Thanks.

Ok then try this:
window.frames["content"].print();
Mar 6 '07 #4
sumittyagi
202 Expert 100+
Ok then try this:
window.frames["content"].print();
sorry I rectify myself:
top.frames["content"].print();
Mar 6 '07 #5
Sorry, didn't work ! Any other idea ?
sorry I rectify myself:
top.frames["content"].print();
Mar 6 '07 #6
Any one ? Seems like its the lenght of jps (TaskNav.jsp). If I take out some code out of TaskNav.jsp, the print of Content works. Kind of wierd. I don't see any errors on the code of TaskNav. Just menus coded in jsp tags.
Any one know any relation of length of jsp (means, long code in jsp) with the focus/print or frame problem ?
Mar 7 '07 #7
Hi,

I also have got the same problem with our intranet-application after we installed XP/SP2 :-(

I try to print a frame with a PDF. With SP1 this worked fine (set focus on the corresponding frame and then print () ). with SP2 I only get an empty page with the printed link to the file on the server. :-(


Does anybody find a solution for this problem?
Mar 12 '07 #8
Good to know that its just not me...
One more thing I like to add, forget my print button. If I right click the frame I want to print (Content) and do print, it still prints all 3 frames....
Any one ?
Hi,

I also have got the same problem with our intranet-application after we installed XP/SP2 :-(

I try to print a frame with a PDF. With SP1 this worked fine (set focus on the corresponding frame and then print () ). with SP2 I only get an empty page with the printed link to the file on the server. :-(


Does anybody find a solution for this problem?
Mar 12 '07 #9

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

Similar topics

2
by: Fred Snider | last post by:
Help! Opening a new window using the window.open( ) command works great for opening new windows and having them on top and having the focus. The window.focus command brings any existing...
1
by: CES | last post by:
All, I'm trying to test if a browser is configured so that I can use popup windows or if it has a popup blocker installed... the only solution I was able to think of, was one that would pop up a...
5
by: Wei | last post by:
I need the current window stay on focus. The user will have to click on exit button to exit the window. How can I do this in asp.net in C#? Thank you
4
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...
0
by: Peter TB Brett | last post by:
Hi folks, I'm currently trying to work out how to detect when a PyGTK window receives the focus from the window manager -- I assume that it must receive some kind of X event, but I can't work...
4
by: Roger | last post by:
Hi, I am confused about the differences between this.window.focus(), window.focus(), and this.focus(). I want to use the calls in a <body onload="..."tag. What are the differences between...
4
by: Jason | last post by:
Hi, Here's the scenario: I have a web application that has window A and window B. A user has both window A and B open - window A is in the foreground and window B is behind it. If the...
3
by: acehigh1983 | last post by:
Is it possible to focus a window in firefox and safari?? i have a webpage that opens another window, it then focuses on the original window (the new window that opened now behind it in the...
4
by: Spizzat2 | last post by:
I'm trying to figure out a workaround to a minor annoyance that I'm coming up with while coding a site. I've got some keyboard shortcuts set up for the site via javascript, and when I press escape,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.