473,793 Members | 2,948 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 8326
Oliver Wong wrote on 30 apr 2007 in comp.lang.javas cript:
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('ht tp://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf');
setTimeout('ggl 2()',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.net wrote in message
news:Xn******** ************@19 4.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('ht tp://www.cs.ubc.ca/~lowe/papers/ijcv04.pdf');
setTimeout('ggl 2()',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
1252
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 transparently to a page in another domain (http://www.clairecharter.com/hosting/axiotonal/index.php) by automatically adding an invisible frame within my own pages. This way nobody can see the redirection.
3
4034
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 page occurs. The problem I'm having is that the redirection happens as soon as the last image is displayed. Here's an example of a normal version where the images rotate continuously and the redirect version that isn't working properly:
14
11099
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 window.open function? I would prefer not to create a separate HTML page. So far all I have is the basic var cwin = window.open('images/KJV-THANKS.gif', 'Thanks', 'width=243,height=420,'); cwin.focus();
7
2119
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 est bien validée car le cookie (crée précédemment) est bien effacé par SetCookie. Pourriez-vous me dire ce qui ne va pas ? Merci d'avance Steph
1
1252
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 there is a link which says 'Generate Invoice'. When the customer clicks on the link a pop-up window appears with a printer friendly Invoice.
0
1483
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" traget="_blank" href="view.aspx?id=3" traget="_blank" href="view.aspx?id=4" traget="_blank"
8
2534
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 %{HTTP_HOST} !^domain\.com.ar RewriteRule ^/(.*) http://domain.com.ar/$1
1
1727
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 (derived from System.Web.UI.Page). So, for instance, my home page's inheritance chain looks like this: HomePage Inherits WebPageBase
2
1432
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? DisplayHeader=Yes&SurveyID=" + lngSurveyID + "','Results')>"; In the onclick event I want to close the current window then open
0
9670
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10211
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10159
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3719
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2917
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.