Solved

javascript onload not opening new windows in IE6

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
split53 challenge 7 95
Weekend adv creator 3 36
servlet filter example 37 58
throw exception 21 43
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…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

786 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