PDA

View Full Version : Need help on where to put script.



Isabel
02-02-2005, 02:26 AM
Hi, I am new to this. Just started taking classes on HTML three weeks ago. I have a website that I did with FrontPage, now I want to put the script so one of the copyrighted pictures will not be copied ( with the no right click)
I don't know exactly where to put it. I know it's supposed to go on the <Head> but where at? I have tired it several times but when I hit the preview
window the code shows on the page. Can someone help me please?
Thanks in advance. Isabel

mwinter
02-02-2005, 12:18 PM
Hi, I am new to this. Just started taking classes on HTML three weeks ago. I have a website that I did with FrontPage,Frontpage really isn't something to use when learning how to author HTML documents. In fact, any WYSIWYG software should be avoided. At this stage, you should be learning how to do things for yourself. I don't think any professional developer (who's worth their salt, at least) uses WYSIWYG environments. They might use Dreamweaver, but mainly for its content management tools.

Remember that HTML is a semantic language: it describes the content of a document (I certainly hope you were taught that!). Presentation should be provided by CSS. You should also validate (http://validator.w3.org/) your mark-up.


now I want to put the script so one of the copyrighted pictures will not be copied ( with the no right click)That is, quite honestly, impossible. No amount of "protection" can prevent a user from taking an image, and no-right-click scripts don't even come close to qualifying as protection (they're easily circumvented). All you can do is make sure no-one would want to. There are two realistic approaches here:


Reduce the quality of the image so it's useless for anything other than sampling the material.
Smack an ugly copyright notice somewhere. It should be in a place close to the focus of the image so it can't just be cropped out, and it should be placed in such a way that it would be difficult to remove (so not over solid colours).

I don't know exactly where to put it. I know it's supposed to go on the <Head> but where at?Anywhere, really. However, I place a strict order on my own mark-up:


<head>
<!-- META elements, if any -->

<title>Blah, blah, blah...</title>

<!-- LINK elements, including links to external style sheets -->

<!-- I only use STYLE elements in test pages (you should use
LINK elements), but when I do use them, they go here.
-->

<!-- SCRIPT elements go here, for example -->

<script type="text/javascript">
/* Script code */
</script>
</head>Note that the only other attribute that should normally appear on a script element is the src attribute[1]. The language attribute should never be used. It has been deprecated for over six years and it just isn't necessary any more.

With regards to the src attribute, it is almost always preferable to place the script code in an external file and use the src attribute to indicate its location. This allows the script to be cached which saves bandwidth.

In case you're wondering why I use the order above, it's for two reasons:


The order is logical, from the point of view of the user agent.
A bug in an older user agent caused problems if a script element was included before style sheet data. I forget what the effect was (either the script or style data was ignored), but I do remember that placing script elements last avoided the issue.
Hope that helps,
Mike


[1] You could also use defer, but that's rarely ever used.

Isabel
02-02-2005, 05:28 PM
I appreciate your help. The picture that needs to have the right click disabled
is not mine. I asked the artist for permission to put it in my page, and that is one of the five or six rules that he gave me in order to use his art. I think I am going to disregard his art and not use it. I am new to this and like I wrote
I am just on lesson three of hTML so it is going to take me a while to understand the coding. I just joined "Dynamic Drive" and I know that I will learn by reading someone elses advice. Once again thank you very much for your help. Isabel

mwinter
02-02-2005, 06:41 PM
The picture that needs to have the right click disabled is not mine. I asked the artist for permission to put it in my page, and that is one of the five or six rules that he gave me in order to use his art.Well, you can still put the script on your page, but this artist is deluded if (s)he thinks it will do any good.

To be frank, no-right-click scripts are actually harmful. The context menu is an important UI component. It shouldn't be tampered with.


Once again thank you very much for your help.You're welcome.

Mike

darco9x2
02-12-2005, 06:30 PM
isnt it true, that all you have to do to get the picture is look at the html scource? so unless you're going to encrypt the scource, wats the point?

mwinter
02-13-2005, 03:49 PM
isnt it true, that all you have to do to get the picture is look at the html scource?There are numerous ways to obtain images from a document:


Right-click and select "Save as..." (or some equivalent). Decent browsers like Firefox and Opera won't let scripts disable the context menu if the user so wishes. That's why "no right-click" scripts are useless.
Disable (or work around) the "no right-click" script then do the above. This can be achieved in various ways, too.



Use a bookmarklet.
Disable client-side scripting.
Hold down the right-mouse button, press enter to dismiss the alert box, then release the button.
Press both mouse buttons simultaneously.
Use the context-menu key on Windows keyboards.


Yet another reason why "no right-click" scripts are useless.
Perform a screen capture of the application.
In Firefox, open the Page Info dialog (either from the context menu, or the Tools menu), find the image in the Media list and select the "Save as..." button.
Use a robot to grab either the document, the entire site(!), or just the images (depending on which program you use).
Find the image in the browser cache.
Find the image URL in the page source and use any HTTP-capable agent to download the file.
Drag-and-drop the image to a directory or an image-manipulation program.
I think that's a fairly (but maybe not totally) exhaustive list of workarounds.


so unless you're going to encrypt the scource, wats the point?You can't encrypt HTML without using some ridiculous client-side script which will render the document useless without scripting support. Even then, you can still use bookmarklets (or the DOM Inspector in Mozilla) to view the "decrypted" source. Besides, no-one's HTML is so amazing that it should need encrypting. All HTML does is mark-up a document and anyone is capable of doing that.

Mike