•
•
•
•
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 363,800 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 4,557 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: 1376 | Replies: 4
![]() |
•
•
Join Date: Aug 2007
Posts: 131
Reputation:
Rep Power: 0
Solved Threads: 0
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:
Thanks
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
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."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
•
•
•
•
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.
php Syntax (Toggle Plain Text)
<?php function reDirect($page) { header("Location: $page"); // tell the browser to go to the new location.. die; // die so we can flush http output immediately } ?>
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!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
•
•
•
•
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!
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
> 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.
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."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
apple beta bon browser browsers development echo email encryption eu europe firefox gecko internet internet explorer internet explorer 7 javascript leak linux memory microsoft mobile mozilla networking news nintendo open-source opera patch paypal pda phishing privacy safari scams security soccer social software spoof super testing url users web web browser webmail website development wii windows
- html/php form for .htaccess validation (PHP)
- windows explorer auto closes! (Windows Vista)
- redirect doesn't redirect without refresh (PHP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: filesize check before upload
- Next Thread: Get coordinates?



Linear Mode