473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Redirection and opening a new window in IE7

I'm trying to have the "submit" button of a form open a new window
which loads a PDF, and also to redirect the window containing the submit
button to a new location. Here's a small HTML file demonstrating my code:

<html>
<body>
<input type="button"
onclick="window.open('http://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf');
window.location = 'http://www.google.ca/';"/>
</body>
</html>

This works in IE6 and Firefox, but it seems to fail in IE7. In IE7,
the redirection to a new page will work, but opening the PDF in a new
window will fail. What can I do to get the script to work in IE6, IE7 and
Firefox?

- Oliver
Apr 30 '07 #1
2 8305
Oliver Wong wrote on 30 apr 2007 in comp.lang.javascript:
I'm trying to have the "submit" button of a form open a new window
which loads a PDF, and also to redirect the window containing the
submit button to a new location. Here's a small HTML file
demonstrating my code:

<html>
<body>
<input type="button"
onclick="window.open('http://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf');
window.location = 'http://www.google.ca/';"/>
</body>
</html>

This works in IE6 and Firefox, but it seems to fail in IE7. In
IE7,
the redirection to a new page will work, but opening the PDF in a new
window will fail. What can I do to get the script to work in IE6, IE7
and Firefox?
It's a timing problem, methinks,
the page with it's javascript is gone before the open has had time
enough.

Try this:

===============================================
<script type='text/javascript'>
function ggl(){
window.open('http://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf');
setTimeout('ggl2()',100)
};
function ggl2(){
location.href = 'http://www.google.ca/';
};
</script>

<input type="button" onclick="ggl();">
===============================================

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 30 '07 #2

"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
>
It's a timing problem, methinks,
the page with it's javascript is gone before the open has had time
enough.

Try this:

===============================================
<script type='text/javascript'>
function ggl(){
window.open('http://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf');
setTimeout('ggl2()',100)
};
function ggl2(){
location.href = 'http://www.google.ca/';
};
</script>

<input type="button" onclick="ggl();">
===============================================
This seems to have fixed it. Thanks.

- Oliver
May 1 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: astpaul | last post by:
Hi, I want to resize the main window through Javascript using the self.resizeTo() function. Nevertheless i've ot a pb: I have a domain (http://www.re-crear.org). This domain is redirected...
3
by: Wazz Up | last post by:
Hi, I'm trying run an image slide show where the images rotate once each, then after the last image in the array has been displayed for the specified amount of time, a redirection to another...
14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
7
by: Steph | last post by:
Bonjour, Je souhaite lancer une redirection vers un fichier php via SRC= dans une condition if (voir ci-dessous en bas du script) mais la redirection ne fonctionne pas. Par contre la condition...
1
by: Jack | last post by:
Hi, I'm having a problem with web page navigation. Senario: I have one web page (webpage1.aspx) which hosts a control containing a datagrid with a list of charges. Underneath the datagrid...
0
by: Dimitrios Mpougas | last post by:
Hello, I have two asp.net pages. The first is a page (main.aspx) wich has four links on it. The href value of each link is: href="view.aspx?id=1" traget="_blank" href="view.aspx?id=2"...
8
by: Luciano A. Ferrer | last post by:
Hi! I was following the http://www.seomoz.org/articles/301-redirects.php article, trying to do that with one of my test sites I added this to the .htaccess file: RewriteEngine On RewriteCond...
1
by: Mike Hofer | last post by:
I really need some help, and I'd appreciate any that you folks can provide. The ASP.NET application in question uses version 1.1 of the .NET Framework. All of the pages use a common base class...
2
by: Sems | last post by:
Hi I have a piece of javascript that is generated like so... strText += "<img style='cursor:hand' src='Resources/SurveyButtons/ Close.gif' onClick=javascript:window.open('ConfirmPage.aspx?...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.