LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-10-2013, 01:55 AM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 31
javascript redirect page


I have the below HTML, which redirects the page to google.com and run close_window to exit the current window

"<a href="http://www.google.com" onclick="close_window()">"

I tested it, it can redirect page OR close window only, but cannot do both at the same time, that means after redirecting to another page, it does not close the window.

Could you advise if I want the window redirect to another page ( www.google.com ) first , then wait 10 second , then close this redirected page ( window ) automatically , how to make it ? thanks
 
Old 10-10-2013, 11:16 AM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
You can't. If you redirect to another page, then that (obviously) unloads your scripts.

One possible solution would be to load the other page in an IFrame and then close the IFrame after 10 seconds.

Last edited by dugan; 10-10-2013 at 11:29 AM.
 
Old 10-10-2013, 11:34 AM   #3
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
Also, what purpose does it serve going to google.com and then closing the window? Can you explain in a bit more detail why you want this?
 
Old 10-10-2013, 11:45 AM   #4
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by dugan View Post
You can't. If you redirect to another page, then that (obviously) unloads your scripts.

One possible solution would be to load the other page in an IFrame and then close the IFrame after 10 seconds.
could advise how to do it ? I am really new to it . thanks
 
Old 10-10-2013, 11:46 AM   #5
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by dive View Post
Also, what purpose does it serve going to google.com and then closing the window? Can you explain in a bit more detail why you want this?
I want to display (redirect) the page for a while ( eg. 10 second ) and then close it.
 
Old 10-10-2013, 11:55 AM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Quote:
Originally Posted by ust View Post
I want to display (redirect) the page for a while ( eg. 10 second ) and then close it.
I'm also curious as to why.

And I'm not impressed that your initial attempt at answering "why" was to repeat yourself verbatim.

Last edited by dugan; 10-10-2013 at 12:09 PM.
 
Old 10-11-2013, 08:59 AM   #7
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
When you tell the browser to "redirect," and it does so, then you lose control. What you must do in this case is to spawn another window, which will then fetch the content of a specified URL, display it by poking it into the DOM structure somewhere, twiddle its thumbs for ten seconds, and then close.
 
Old 10-15-2013, 08:29 PM   #8
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by sundialsvcs View Post
When you tell the browser to "redirect," and it does so, then you lose control. What you must do in this case is to spawn another window, which will then fetch the content of a specified URL, display it by poking it into the DOM structure somewhere, twiddle its thumbs for ten seconds, and then close.
thx reply , that means this is impossible to do that ?
 
Old 10-15-2013, 09:17 PM   #9
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,225

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
Quote:
Originally Posted by ust View Post
thx reply , that means this is impossible to do that ?
I already told you (in post #2) that it's impossible.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
read web page javascript manolakis Programming 1 09-04-2011 11:51 AM
Redirect the Page to home page? your_shadow03 Linux - Newbie 3 12-17-2009 09:36 AM
Redirect page koscek Programming 9 11-02-2007 03:29 AM
javascript: retrieve cookie of parent page from child page kpachopoulos Programming 4 01-08-2007 05:36 AM
Executing Javascript within a PHP page Linh Programming 3 09-26-2003 05:08 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration