Solved

javascript onload not opening new windows in IE6

Posted on 2009-05-12
4
279 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 500 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

706 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now