473,804 Members | 2,123 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing the window object - problem with Internet Explorer (2)

3 New Member
From a documentlist the user activates links to see the document in a popup.

The link (JSP):
Expand|Select|Wrap|Line Numbers
  1. <a href='javascript:var w=windowOpenDok("${docURLPDFFromTiff}","document",0.5,0.8);w.focus();'>
  2.  
The function:
Expand|Select|Wrap|Line Numbers
  1.     function windowOpenDok (url,name,relWidth,relHeight) {
  2.         var x = window.open (
  3.             url,
  4.             name,
  5.             "height=" + Math.floor(screen.availHeight * relHeight) + ",width=" + Math.floor(screen.availWidth * relWidth) + ",resizable=yes,scrollbars=yes,toolbar=yes,status=yes",
  6.             false
  7.         );
  8.         return x;
  9.     }
  10.  
works as expected in Mozilla, Firefox but only partially in Internet Explorer. The command
Expand|Select|Wrap|Line Numbers
  1. w.focus();
throws an error in IE (objectError) if the window is already there and contains no HTML neither XHTML but something loaded with mime-type "applicatio n/pdf". Bringing the existing window manually to foreground it shows the expected new document.

What do I wrong? It looks like the reference to the window is ruined after loading the pdf.

Many Thanks for any help.
mumpi
Oct 2 '07 #1
8 2685
dmjpro
2,476 Top Contributor
From a documentlist the user activates links to see the document in a popup.

The link (JSP):
Expand|Select|Wrap|Line Numbers
  1. <a href='javascript:var w=windowOpenDok("${docURLPDFFromTiff}","document",0.5,0.8);w.focus();'>
  2.  
The function:
Expand|Select|Wrap|Line Numbers
  1.     function windowOpenDok (url,name,relWidth,relHeight) {
  2.         var x = window.open (
  3.             url,
  4.             name,
  5.             "height=" + Math.floor(screen.availHeight * relHeight) + ",width=" + Math.floor(screen.availWidth * relWidth) + ",resizable=yes,scrollbars=yes,toolbar=yes,status=yes",
  6.             false
  7.         );
  8.         return x;
  9.     }
  10.  
works as expected in Mozilla, Firefox but only partially in Internet Explorer. The command
Expand|Select|Wrap|Line Numbers
  1. w.focus();
throws an error in IE (objectError) if the window is already there and contains no HTML neither XHTML but something loaded with mime-type "applicatio n/pdf". Bringing the existing window manually to foreground it shows the expected new document.

What do I wrong? It looks like the reference to the window is ruined after loading the pdf.

Many Thanks for any help.
mumpi
I am rewriting the code.
Have a look over it.

The link (JSP):
Expand|Select|Wrap|Line Numbers
  1. <a href='javascript:var w=windowOpenDok("${docURLPDFFromTiff}","document",0.5,0.8);if(typeof w) w.focus();'>
  2.  
The function:
Expand|Select|Wrap|Line Numbers
  1.     function windowOpenDok (url,name,relWidth,relHeight) {
  2.         var x = window.open (
  3.             url,
  4.             name+Math.round(Math.random()*1000),
  5.             "height=" + Math.floor(screen.availHeight * relHeight) + ",width=" + Math.floor(screen.availWidth * relWidth) + ",resizable=yes,scrollbars=yes,toolbar=yes,status=yes",
  6.             false
  7.         );
  8.         return x;
  9.     }
  10.  
Good Luck.

Kind regards,
Dmjpro.
Oct 2 '07 #2
mumpi
3 New Member
Thank you. The new code works because every call to the window.open function opens a new window. But I would prefer to reuse the same window and add the new document to the history. That enables the user to go forward and backward.

Strange enough IE showed even with the test by typeof w an Error. In my german IE the error msg says "Mitglied nicht gefunden" at position ... typeof (here)w...

Translated to english that could mean: w is there but the typeof asks a property of w which makes the thing crash?

Consider that test. Instead of w.focus():
Expand|Select|Wrap|Line Numbers
  1. javascript:var w=windowOpenDok("${docURLPDFFromTiff}","document",0.5,0.8);alert (w.name);
  2.  
shows 'document' whether the window is new or was existing. No crash or error. It seems that typeof and focus() do not work if the window was already there when calling window.open(). Strange?!

still helpless; many thansk for support.
mumpi
Oct 3 '07 #3
dmjpro
2,476 Top Contributor
If you want to reuse the window.
Then have a look at this code.

Expand|Select|Wrap|Line Numbers
  1. var new_win = null; //defined externally
  2. function new_window(url)
  3. {
  4.  if(!typeof new_win) new_win = window.open(url,"win_name"+Math.round(Math.random()*100),"win_style");
  5.  else new_win.location.href = url;
  6. }
  7.  
Have a try with this :-)
Good Luck !

Kind regards,
Dmjpro.
Oct 3 '07 #4
mumpi
3 New Member
Thank you for your proposal. Unfortunately it does not help.

This more global variable new_win is ruined as soon as content donwloaded is mime-type "applicatio n/pdf" and the acrobat reader plugin is loaded. So the behaviour is very much the same as with the original scripts.

I am afraid we have to look for another workaround. Tha main question being why is that window object ruined after it loaded acrobat plugin with a pdf-document in IE (and not in FF, Moz. etc.!)
Oct 4 '07 #5
Sebastian Goetz
2 New Member
Hi Mumpi,

we have exactly the same problem.
We use a Java PDF-Engine to create PDFs on runtime. The same window should be used to display the results. When the user selects PDF output and the PDF is displayed by the PDF Plugin inside the browser window (and not by starting an AdobeReader instance), we get a Javascript error "Mitglied not found" whenfocusing the new window. As you mentioned this only happens when the window was already there and the content was PDF before.
If the user has selected HTML output (as our pages can) the thing works as often as he likes.

Did you find a solution for that?

Regards

Sebastian
Nov 6 '07 #6
acoder
16,027 Recognized Expert Moderator MVP
Hi Sebastian, welcome to TSDN!

Interesting problem. Have you tried loading the PDF in an iframe within the child window?
Nov 6 '07 #7
Sebastian Goetz
2 New Member
Well, we just found a proprietary solution:

It appears that though the window object itself seems to be broken, you may still close the window using the close() function. So have a look at this solution:

Expand|Select|Wrap|Line Numbers
  1. printwin = window.open(href, "Print");
  2. try
  3. {
  4.     // exception if adobe reader plugin version >= 7 is used
  5.     printwin.focus();
  6. }
  7. catch(e)
  8. {
  9.     printwin.close();
  10.     printwin = window.open(href, "Print");
  11.     printwin.focus();
  12. }
This works for us an closes an open window if the focus() call hrows the exception and reopens it. The cost of the thing is that the content is loaded twice if the execption is thrown.
Nov 7 '07 #8
acoder
16,027 Recognized Expert Moderator MVP
Thanks for posting your solution, even if it's not ideal. Hopefully it'll help someone with a similar problem.
Nov 7 '07 #9

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

Similar topics

0
1101
by: Sepia | last post by:
Hi, I am totally new in learning c sharp language. I have made an intranet web site with ASP. I want to make a window that has my name on the title bar and works like an internet explorer without having address bar, internet explorer icons and menus. The window should call my intranet web site default page into it and should work like internet explorer do. I want to install this small window program to all the computers in the network,...
0
932
by: Mark | last post by:
We've run into a problem using IE on Mac with Internet Explorer. If you use Response.Redirect (a server side redirect) about 9 - 10 times, with one per ..aspx page, the postbacks on our ASP.NET server controls fail to execute. We just get a spinning wheel. The problem occurs on both IIS 5.0 and 6.0 running on Windows 2000 Server and Windows 2003 Server. I've had an offline discussion with an entirely different company that identified...
9
3118
by: Jensen bredal | last post by:
Is there any way i can view my web page in full screen mode? F11 still hhas the internet explorer tool bar. Many thanks in advance JB
1
2541
by: =?Utf-8?B?dG9ueXppb24y?= | last post by:
hi all..i hope anyone can help me.. i bought my laptop this month with windows Vista preloaded, and i have a problem with internet explorer 7, sometimes when i try to scroll down on a page the window minimizes. this happens sometimes even when i just click anywhere on the page. I tried to get an answer from the microsoft tech site but it said that i would have to pay cause my product code couldnt be found.. i have a problem with that cause...
2
3158
by: swethak | last post by:
Hi, I am getting the problem the problem with google map in Internet Explorer. This map worked fine in mozilla . When i opened the same map in Internet Explorer i am getting the error message as in alert box as " Internet Explorer cannot open the Internet site http://google.citycarrentals.com.au/viewalllocations.php . Operation aborted". It is working in Mozilla . Here i mentioned my code . I am facing this problem several...
1
1613
by: Finnian Varney | last post by:
Hi All, I'm a photographer and have a java based access code for clients to login and see the shoots I have done for them. The page used to function fine until I tried to update the page to a new aesthetic and have had all manner of issues since then. The idea is someone clicks through to the 'clients login' page where this code is and they see a text box and a button to submit the form. It then brings up a popup window where the url is...
0
9715
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10354
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
10097
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9175
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
7642
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
6867
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
5535
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3002
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.