Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: Onfilemissing

  1. #1
    New Coder
    Join Date
    Jul 2002
    Location
    Sweden
    Posts
    66
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question Onfilemissing

    How do I check if a file is missing?

    <a onclick && onfilemissing( alert('file not found') );">check file</a>

    Not going to use it like this at all, but I thought it would be easier to understand if I explain it like this...

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    you can do it via XMLHTTP in Javascript or better, you can customize your own HTTP 404 File not Found page and set up your webserver not to display the default 404 page but instead display the customized page.

    see this sample:

    http://msdn.microsoft.com/library/de...s/blahblah.asp
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New Coder
    Join Date
    Jul 2002
    Location
    Sweden
    Posts
    66
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thats one way, but I was trying to accomplish a for that loop until a page can't be found.

    Page1.htm -> find
    Page2.htm -> find
    Page3.htm -> find
    Page4.htm -> not find, end loop

    Had one idea, but I don't know if it would work in any way, it involved onerror...

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    If it were images you can use the Image object and use onerror and onload handlers to check for their existence. Though you can use Image object for non-image files, it would always fire onerror event even if files exist.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #5
    New Coder
    Join Date
    Jul 2002
    Location
    Sweden
    Posts
    66
    Thanks
    1
    Thanked 0 Times in 0 Posts
    There isn't then a proper way to do it exept on images?

  • #6
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    There's a method to do it, but it's not worth the effort.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #7
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    As I said in my first post, you can do it via XMLHTTP. The question here is why do you want to do such a thing.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •