1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Add image to alert box message?

Discussion in 'JavaScript' started by KangBroke, Mar 28, 2012.

  1. #1
    Is it even possible to do this, I have a disable right click script, And in the alert window which pops up I can edit the message, even add ascii characters, I just can not get an image to show up.

    Google searches say its not possible, some suggest a div overlay, just not sure how to implement a div overlay pop up alert with disabled right clicking for the entire page.
     
    KangBroke, Mar 28, 2012 IP
  2. rainborick

    rainborick Well-Known Member

    Messages:
    424
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    120
    #2
    You can't add an image when you use alert(). You would need to create your own pop-up of some kind, whether it's a separate window or a <div>. But do yourself a favor and don't waste any more time on disabling right-clicks. You won't stop anybody who wants to copy your content. You'll only annoy your legitimate users.
     
    rainborick, Mar 31, 2012 IP
  3. teamnirvana

    teamnirvana Active Member

    Messages:
    844
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    60
    #3
    I second Richard's opinion here. Using a pop-up reduces the subtlety and more over the extra weight from the right-click-disabled script is a strict no-no. What's stopping you from using a modal window and embedding the image using <img> tag?

    There are tons of scripts to enable modal windows which are not only visually enticing but also act as a funnel to increase your subscriptions.

    Just my 2 cents.
     
    teamnirvana, Oct 24, 2015 IP
  4. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,998
    Best Answers:
    253
    Trophy Points:
    515
    #4
    So you have a bloated train wreck of scripttardery that's easily bypassed... go on:

    That's because alert only accepts CDATA not markup. You cannot put an image into an alert since it's a system event, not a markup element drawn by the browser. Quite literally the majority of browsers create an actual OS window and dialog, NOT using HTML or images or any of that malarkey.

    It involves creating a DIV or other element and throwing even MORE scripttardery at the page -- of course since some browsers let you block the page from trapping right clicks, and such scripting is easily bypassed and/or disabled by adblock and other "Screw you you sleazeball ****" anti-malware, what you are trying to do is an effort in futility that honestly, I'd just get rid of entirely.

    Hell, most of the time you want to bypass a right-click disabler in Firefox? Double-click. NO joke.

    It's another of those things that's so easily disabled or slapped aside, there's no point in even TRYING to waste code on it.

    -- EDIT -- oops, didn't notice this was a bounce of a three year old thread.

    But if you load up that "free as a bird" site with it's silly ATTEMPT at blocking right click, shift-right click in FF. So much for that.
     
    deathshadow, Oct 25, 2015 IP