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 6 of 6
  1. #1
    New Coder
    Join Date
    Oct 2004
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer Cancel image loading

    hi all,
    I need a javascript(MUST be javascript) that can prevent an image from loading on a page but not actually preventing the rest of the page from loading.Just kind of noticing that an image from a certain URL is attempting to load and blocking it before it can continue to load.It can be as long as you like but must be able to be compiled into one single line instead of multiple lines so no 'body onload' scripts unless there are no other parts to the script so it can't have some of the script information in the head of a document and some in the body, i need something that would just fit into the body or just the head section but all on one line if that makes any sense.
    kindest regards,
    skool h8r.

  • #2
    Regular Coder
    Join Date
    Oct 2004
    Posts
    256
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I think it's unlikely you'll be able to do that "in one line", as you requested.

    The javascript that is used in events on other elements simply calls a function defined elsewhere on the page (usually in the head), and it's that function that actually tells the browser what to do.

  • #3
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Your question was answered here....

  • #4
    New Coder
    Join Date
    Oct 2004
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer

    Thanks for the reply but that's the thing, hosts files can't be included because it's to be included in a browsers internal workings.I read something about 'body.onload', maybe something could be done with that.maybe something like this:

    body.onload("http://www.imageurl.com/imageadvert.jpg") image.stopload;

    Hope that explains it a little better.I really need this as soon as possible but if someone makes one that works then their name will be included in the browsers credits and can become my first beta tester if they like.I'll tell you more about the browser another time though.If it just can't be done then it's ok, no problem, just means less advert blockin' capabilities.
    HTH

  • #5
    fci
    fci is offline
    Senior Coder
    Join Date
    Aug 2004
    Location
    Twin Cities
    Posts
    1,345
    Thanks
    0
    Thanked 0 Times in 0 Posts
    why not have regular expressions parse out what you don't want? that's how proxomitron worked, or of course you could use getElementsByTagName then cycle through and do a regex match on that.. or see how Adblock does it.

  • #6
    New Coder
    Join Date
    Oct 2004
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    hmmm, good idea actually. If i add *imageurlterm* to it, that may work, hope it does.Thanks for that, i'll give it a try.


  •  

    Posting Permissions

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