User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 426,485 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,225 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 2235 | Replies: 4
Reply
Join Date: Aug 2007
Posts: 167
Reputation: tanha is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
tanha tanha is offline Offline
Junior Poster

Redirect page function problem with Firefox browser

  #1  
May 5th, 2008
Hi everybody,
I am using a java script function which redirect to the page according to the given parameter, and it is working as desired in IE, but I found that it not work with Firefox browsers, so some one plz guide me how it is possible to have the same function which could work on IE and Mozilla firfox.

The function code:

<?php
function reDirect($page)
{
     $s = "<script language = 'javascript'>
     window.navigate('$page');
     </script>";
     return $s;
}

Thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,858
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 344
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: Redirect page function problem with Firefox browser

  #2  
May 8th, 2008
There is no navigate function for the window object. Maybe try something like:
<?php
function reDirect($page)
{
     $s = "<script language = 'javascript'>
     window.location.href = '$page';
     </script>";
     return $s;
}
Last edited by ~s.o.s~ : May 8th, 2008 at 1:21 pm.
I don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Join Date: Sep 2005
Posts: 689
Reputation: digital-ether has a spectacular aura about digital-ether has a spectacular aura about 
Rep Power: 6
Solved Threads: 41
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Practically a Master Poster

Re: Redirect page function problem with Firefox browser

  #3  
May 10th, 2008
Originally Posted by tanha View Post
Hi everybody,
I am using a java script function which redirect to the page according to the given parameter, and it is working as desired in IE, but I found that it not work with Firefox browsers, so some one plz guide me how it is possible to have the same function which could work on IE and Mozilla firfox.

The function code:

<?php
function reDirect($page)
{
     $s = "<script language = 'javascript'>
     window.navigate('$page');
     </script>";
     return $s;
}

Thanks


Unless there is a specific need for using javascript, you could redirect the browser using HTTP headers.

  1. <?php
  2.  
  3. function reDirect($page)
  4. {
  5. header("Location: $page"); // tell the browser to go to the new location..
  6. die; // die so we can flush http output immediately
  7. }
  8.  
  9.  
  10. ?>
Last edited by digital-ether : May 10th, 2008 at 5:05 am.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote  
Join Date: Sep 2005
Posts: 689
Reputation: digital-ether has a spectacular aura about digital-ether has a spectacular aura about 
Rep Power: 6
Solved Threads: 41
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Practically a Master Poster

Re: Redirect page function problem with Firefox browser

  #4  
May 10th, 2008
Originally Posted by Mohan0704 View Post
Isn't the die function the same as the exit function? Also, you can put a message to show people that the program is exiting
such as:
exit ('The program is exiting')
and
die ('The program is dying')


I believe they are the same.

The user would never see the message however under normal circumstances.

Its always good to add a bit of HTML explaining whats happening however, and add the JS that will redirect in case the browser fails to do a HTTP redirect.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,858
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 344
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Lazy, Useless & Apathetic

Re: Redirect page function problem with Firefox browser

  #5  
May 10th, 2008
> You could just use a meta command (like this):

The W3C actually recommends against the use of such tricks for redirection. If Javascript is not a must, Digital Ether's suggestion seems good enough.
I don't accept change. I don't deserve to live.

Happiness corrupts people.

Failing to value the lives of others cheapens your own.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 4:43 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC