Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

javascript onload not opening new windows in IE6

Posted on 2009-05-12
4
Medium Priority
?
296 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses

715 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