Current location: Hot Scripts Forums » General Web Coding » JavaScript » redirect page


redirect page

Reply
  #1 (permalink)  
Old 03-01-06, 04:59 AM
corina corina is offline
New Member
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
redirect page

Hi everyone

I have the next scriptje that unfortunately does not work:

Code:
<html> 
<head><title>test.html</title></head> 
<SCRIPT LANGUAGE="JavaScript"> 
function checkFrame() { 
var obj = document.frames.frame; 
if (obj.document.title != "The page cannot be found") { 
obj.location = "fout.html"; 



} 
} 


</SCRIPT> 
<body onload="frame.location.href = self.location.search.substr(1)"> 
<iframe name="frame" height="100%" width="100%" align="middle" 
border="0" frameborder="no"> </iframe> 

</body></html>
Gladly I, if the page cannot be reflected, an alternative (wrongly)
page reflect in the frame.


Can someone help me?


thx alot

Last edited by TwoD; 03-02-06 at 07:05 PM. Reason: Please use [code][/code] wrappers.
Reply With Quote
  #2 (permalink)  
Old 03-02-06, 07:17 PM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
It is impossible to reference to the document object of a frame if a page has failed to load. You will only get an "Access Denied" error if you try to do document.frames.frame.document .
JavaScript isn't allowed to do anything to a page that doesn't belong to the site it was started on.

Also, it is not good practice to use give a name attribute to a a tag and reference it directly. That will only work in Internet Explorer. Do document.body.frame instead or give the tag an id="frame" attribute and reference to it using document.getElementById('frame').
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Classified Ads skipper23 Perl 3 11-22-05 02:22 AM
page browsing problem mivec PHP 3 04-17-04 03:43 AM
PHP redirect page shack PHP 3 03-27-04 11:32 AM
How to redirect page in PHP!! askme PHP 2 02-12-04 06:22 PM
Classified Ads skipper23 Perl 2 12-30-03 03:43 AM


All times are GMT -5. The time now is 11:04 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.