Browser Alert for Right-Click on Image - javascript

Does anyone know of a window alert script (browser message) that would make an alert appear when a user right-clicks on an image? The idea is to warn someone that the image is copyrighted, or that they need to cite the source if they want to use it, etc. If such a script exists, is it possible to do this for just a specific image or images on the page, rather than a right-click anywhere on the page? Thanks for any help.

On a basic level:
<img onclick="window.alert('All copyrights reserved');"
oncontextmenu="window.alert('Image context menu is disabled');return false;"
src="some.jpg"
/>
Generally windows alerts are bad for usability. I suggest you look at another solution to protect your copyrights.
Also note that this does not prevent someone who is smart enough to save the image another way. It is very easy to open the browser inspector & save the image from there or remove the onclick/oncontextmenu to allow access.

Related

Prevent saving images from website (save whole page)

Is there a way to prevent users from saving images when they do a save as?
I have already disabled right click in the pages using javascript as well as adding the following header:
<meta http-equiv="imagetoolbar" content="no" />
But if I go for example in OPERA and do page -> save as -> html file with images all the images will get saved. IS there a way to counter this?!
They will always be saved. Your browser caches images locally anyway, so they'll always be downloaded to a users machine and if they wanted to take them, they would.
The only way to stop images from being saved is don't put them on the internet.
No, there is not. If an HTTP client can download it, it can save it. It is a futile effort to try and counter this.
Edit: Also, I'd like to point out that most browsers allow the user to forcefully (re-)enable the right-click menu on evil websites who try and take that freedom away from them.
No, there is always a way for users to get your images. If you dont want your images reused consider watermarking them if this is appropriate or branding them with the company logo.
Disabling right click will just annoy the hell out of users who probably wouldnt steal your images anyway, and be a minor inconvenience to those who would.
No right click? Just screenshot the page, maybe view source and go directly to the image file, etc etc.
Just out of curiosity, why do you even want to do this?
You can do what the author of this page did with a picture of Homer Simpson. Look ma, no <img>!

Legally avoiding popup blocking

What is causing some browsers to see my code as unsolicited?
I have a web site devoted to helping people with interactive sessions. It starts with the user clicking [Begin] so this is a consented action. This should (1) open a popup while (2) redirecting the first page to a end page as below :
<head>
<SCRIPT language="JavaScript">
function openwindow(){window.open("{INTERACTION}","interaction","resizable=0,width=800,height=600,status=0");}</SCRIPT>
</head>
<body>
<FORM action="end.php" method="{METHOD}" >
<input type="submit" class="button"
onClick="javascript: openwindow()"
value="Begin" />
</FORM>
</body>
As said, this is not trying to open an unrequested popup but some strains of IE and Chrome appear to be treating it as such. I have been trying to get a fix, most recently digesting this post.
In it Bobince comments
these days, you don't really need to ask the question “was my unsolicited popup blocked?”, because the answer is invariably “yes” — all the major browsers have the popup blocker turned on by default. Best approach is only ever to window.open() in response to a direct click, which is almost always allowed.I'm quite happy to buy into this principle because I simply want my popup to open.
What is causing some browsers to see my code as unsolicited?
I'd appreciate any help you could give me. (as you might have guessed, client side is not my bag and this topic has been bugging me for ages).
Many thanks in advance (and fingers crossed)
Giles
No much you can do. You could ask your users to disable pop-up blockers or inform them that a pop-up blocker is enabled by checking the window object ref returned by window.open()
e.g.
var w = window.open('http://domain.com');
if(!w) {
//an alert in this example
alert('oops..seems like a pop-up blocker is enabled. Please disable');
}
you could find another way and try what Brad suggests.
There isn't anything you can do about this. Some popup blockers still block everything, even in response to a user clicking. The best you can do is suggest your users turn off popup blockers, or find a different way to do what you want to do. A popular method is the div that appears on top of all others on your page, like Lightbox.
There are many jQuery plugins which make this easy.
You have (at least?) 2 options to deal with this:
if you want to keep using popups, display a very visible warning for your users, pointing them to instructions on how to configure their browser to whitelist your domain (like the banners that appear on top of StackOverlow.com when you gain new privileges, or even like the banners Chrome is showing for actions - they are web-based as well);
use an iFrame and load its content based on your user's click.

Disable 'Download This Video' Real Player Button In Browser

Is there any way to disable the "Download This Video" button from RealPlayer. It seems that when users have RealPlayer installed on their machines, it automatically adds a "Download This Video" button to any SWF that loads an FLV.
Edit: My intention isn't to prevent someone from downloading the SWF or FLV, I would just like to remove the ugly button that RealPlayer adds on top of my Flash content.
This is a pointless attempt to control something that can easily be circumvented. This is the same argument as "how can I prevent people from saving the images off my site".
There's always a way.
For example: http://www.downloadhelper.net/
After you embed the Flash content, remove the following attribute from the embedding tag:
type="application/x-shockwave-flash"
You will notice that the download button will disappears because it can't tell what exactly the content is. But this is only a hack, not the best practice of getting the task done.
there is an easy way of removing that download video thing from chrome and I found it. Click on it, then click the wheel to open the settings for Real Player, then just turn it off.
it took me a while, as no one has ever answered that question before.

Javascript for removing menu and scroll bars

I have this script on my html page:
<script language='javascript'>parent.resizeTo(550,510);</script>
I'd like to add to it so it positions the window in the middle of the screen. Also, I want to remove the address and tool bars (I've managed to hide the scrollbars by using body{overflow:hidden;}).
I know how to do this using JS upon opening a new window from the browser but this needs to work from clicking a link on a PDF.
Does anyone have any suggestions? Thank you!
You can't remove address bars, etc. from the user's browser window (even if the user is only you) unless you create a new window object. And the trend is toward removing more and more of your ability to "customize" such popup windows, for security reasons.
This is actually a feature, not a bug. Think about it.
If you're opening a browser window from a separate application, the page starts off its life with a completely-decorated browser window. There's no way to make those decorations go away after the page is loaded.
While I seriously doubt the justification of your desires the way to do it is to somehow open a window. That means that your pdf links to a page that as its action will open a window with an url that has the actual content. The pdf links to a page that is basically a redirector. You give the final URL as a parameter and launch it. Of course you need to disable the popup blocker for this to work, but you should not even consider doing this on a public (no browser control) website anyway. You also might want to add to the redirector page a button that the user can click to open the page if it was blocked by the popup blocker.

add bookmark in Firefox without any dialog box

Using JavaScript, is it possible to add a bookmark in Firefox directly, without opening any dialog box? That is, I want the user clic on a link and that the bookmark is automatically created, without the need to any further step.
Fortunately, no. It would be a horrible breach of security.
Could be a different story in the context of a Firefox Extension, but I assume you are asking for a normal web page.
If it was possible, any possible website would be able to create any kind bookmark, without the user even noticing.
As a user, I certainly hope this is not possible ^^
(And, as a developper, I don't think it is)

Categories