Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

javascript onload not opening new windows in IE6

Posted on 2009-05-12
4
Medium Priority
?
302 Views
Last Modified: 2012-05-06
Code below works great for opening my pdf's in a new window so that my ajax code doesnt reset the page...but...not in ie6...any ideas?
function fNewPDFWindows ()  
{  
if (!document.getElementsByTagName) return false;  
var links = document.getElementsByTagName("a");  
for (var eleLink=0; eleLink < links.length; eleLink ++) {
	if (links[eleLink].href.indexOf('.pdf') !== -1) {
		links[eleLink].onclick =
		function() {
			window.open(this.href,'resizable,scrollbars');  
			return false;
			}
			var img = document.createElement("img");
			img.setAttribute("src", "includes/new-win-icon.gif");
			img.setAttribute("alt", "(opens in a new window)");
			links[eleLink].appendChild(img);  
			}
	   	}
	}   
 
function addLoadEvent(func)
{
var oldonload = window.onload;
if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } }
addLoadEvent(fNewPDFWindows);

Open in new window

0
Comment
Question by:SystemApe
  • 2
4 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 24367458
pop-up blocker on?
0
 

Author Comment

by:SystemApe
ID: 24367568
Yes but still opens in same window when I turn it off
0
 
LVL 92

Expert Comment

by:objects
ID: 24370091
better off asking in the javascript zone, this ihas nothing to do with java

0
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 24370189
>                         window.open(this.href,'resizable,scrollbars');  

try

                        window.open(this.href,'mypdf', 'resizable,scrollbars');  


whats stopping you using a target in a tag
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question