From a documentlist the user activates links to see the document in a popup.
The link (JSP): -
<a href='javascript:var w=windowOpenDok("${docURLPDFFromTiff}","document",0.5,0.8);w.focus();'>
-
The function: -
function windowOpenDok (url,name,relWidth,relHeight) {
-
var x = window.open (
-
url,
-
name,
-
"height=" + Math.floor(screen.availHeight * relHeight) + ",width=" + Math.floor(screen.availWidth * relWidth) + ",resizable=yes,scrollbars=yes,toolbar=yes,status=yes",
-
false
-
);
-
return x;
-
}
-
works as expected in Mozilla, Firefox but only partially in Internet Explorer. The command
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
8 2685
From a documentlist the user activates links to see the document in a popup.
The link (JSP): -
<a href='javascript:var w=windowOpenDok("${docURLPDFFromTiff}","document",0.5,0.8);w.focus();'>
-
The function: -
function windowOpenDok (url,name,relWidth,relHeight) {
-
var x = window.open (
-
url,
-
name,
-
"height=" + Math.floor(screen.availHeight * relHeight) + ",width=" + Math.floor(screen.availWidth * relWidth) + ",resizable=yes,scrollbars=yes,toolbar=yes,status=yes",
-
false
-
);
-
return x;
-
}
-
works as expected in Mozilla, Firefox but only partially in Internet Explorer. The command
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): -
<a href='javascript:var w=windowOpenDok("${docURLPDFFromTiff}","document",0.5,0.8);if(typeof w) w.focus();'>
-
The function: -
function windowOpenDok (url,name,relWidth,relHeight) {
-
var x = window.open (
-
url,
-
name+Math.round(Math.random()*1000),
-
"height=" + Math.floor(screen.availHeight * relHeight) + ",width=" + Math.floor(screen.availWidth * relWidth) + ",resizable=yes,scrollbars=yes,toolbar=yes,status=yes",
-
false
-
);
-
return x;
-
}
-
Good Luck.
Kind regards,
Dmjpro.
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(): -
javascript:var w=windowOpenDok("${docURLPDFFromTiff}","document",0.5,0.8);alert (w.name);
-
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
If you want to reuse the window.
Then have a look at this code. -
var new_win = null; //defined externally
-
function new_window(url)
-
{
-
if(!typeof new_win) new_win = window.open(url,"win_name"+Math.round(Math.random()*100),"win_style");
-
else new_win.location.href = url;
-
}
-
Have a try with this :-)
Good Luck !
Kind regards,
Dmjpro.
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.!)
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
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?
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: - printwin = window.open(href, "Print");
-
try
-
{
-
// exception if adobe reader plugin version >= 7 is used
-
printwin.focus();
-
}
-
catch(e)
-
{
-
printwin.close();
-
printwin = window.open(href, "Print");
-
printwin.focus();
-
}
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.
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.
Sign in to post your reply or Sign up for a free account.
Similar topics |
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,...
|
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...
|
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
|
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...
|
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...
| |
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
| |
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |