PDA

View Full Version : Couple of Questions


Gulf Images
02-03-2003, 03:03 PM
I am looking for a way to disable the status bar from showing the "now opening page...." message that shows the source of a picture while it is loading.

I am also trying to figure out a way of disabling the ability to drag and drop an image from the browser to the desktop.

Sorry if this is in the wrong section, I'm new here.

I appreciate any assistance.

Cheers,
Bobby

beetle
02-03-2003, 04:10 PM
Well, nothing that I tell you here is foolproof, but this should get you going

<script type="text/javascript">
document.onmouseover = function() { window.status = ''; }
document.ondragstart = return false;
</script>

The drag disabling will only work in IE, I think.

Gulf Images
02-03-2003, 04:47 PM
Thanks for your help!

I tried the code in the head and then in the body, but it appears not to work. Any suggestions?

Thanks again,
Bobby

GoHF
02-03-2003, 05:05 PM
Well, drag is a kind of recent thing on IE, so it may not work perfectly all the time. Besides users can left click on the image and go to "Properties" and get the image's URL.

Instead of onmouseover, I would use onmousemove, but then again, I see nothing wrong with using any of them.

As far as drag being disabled, there can be some alternatives to disabling it programatically. Do you know the height and width of the images you are going to show? If you do, try putting the images as the background of a table or a div that have the image's dimensions. That way they need to look at the code to know where the image is coming from:

instead of <img src=imgFile width=imgWidth height=imgHeight> use

<table cellspacing=0 cellpadding=0 border=0 width=imgWidth height=imgHeight>
<tr><td background=imgFile>&nbsp;</td></tr>
</table>

- or -

<div style="width: imgWidth; height: imgHeight; backgroud-image: url(imgFile)"></div>

If you don't know the size of the images, it can get messy, but it's doable. Does the above work or do you want me to look into some approaches that don't require you to know the sizes of the image?

Gulf Images
02-03-2003, 06:28 PM
Thanks GoHF, I'll give it a try and let you know.

I really appreciate it.

I tried it and it appears to do eveything I want except it will still show the image source in the status bar as it is downloading.

I know that there are many ways to lift a picture such as screen capture etc..., but I am just trying to make it as hard as possible.

Thanks,
Bobby

GoHF
02-03-2003, 11:42 PM
I will understand if you don't exactly like this approach, for being strictly IE 5+, but this way you don't need to know image sizes and there is no drag-n-drop OR left click to save either Image or Background (which may happen on the approaches I gave you before).

<div style="width: 20;
FILTER: progid:DXImageTransform.Microsoft.AlphaImageLoader (src=IMAGEFILE,sizingmethod=image)"></div>

This will load IMAGEFILE and resize the div to that image's dimension. Notice, where it says "sizingmethod=image", leave it like that, that's the way it's supposed to be. Just change IMAGEFILE with your image's url. The width of the div is set to 20, but you can set it to whatever value you like, as the filter will auto-resize the div to the image's size. If you want more info on this filter and on how it works:

http://msdn.microsoft.com/workshop/author/filter/reference/filters/alphaimageloader.asp

By the way, I've also made a Jscript approach on this, which is bound to work only on IE as well, but if you want me to, I'll upload it somewhere :) just keep those challenges coming.