PDA

View Full Version : Fail load from double click, accept from code load


robertsont
08-13-2004, 10:46 AM
Loading an HTML fole offline. Is it possible to write an html file that, when it is loaded in the traditional fashion, i.e. double clicked (:-)!) either fails to load or returns a dhtml popup that informs the user to close the file. However when the file is loaded from within a window using a script like that below loads normally?

Regards,

Tom

<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Hoop Hooper (hooper119@aol.com) -->
<!-- Web Site: http://www.angelfire.com/pa3/muddas -->
<!-- Modified: Larry McClurg (larry@honeybells.com) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
// Thank you Larry McClurg for the cross-browser fix
function whatFile() {
window.location= 'file:///' + document.form1.cmuds.value;
}
// End -->
</script>

robertsont
08-13-2004, 10:48 AM
fole=file

agent002
08-13-2004, 10:49 AM
you could try checking document.referrer:
if(document.referrer != 'http://www.something.com/some/file.html'){
// it was loaded directly!
}

agent002
08-13-2004, 10:49 AM
Originally posted by robertsont
fole=file
You could hit "Edit" below your post :)