HTML Interview Questions and Answers -08
Is it possible to make the HTML source not viewable?
In short, there is no real method or script for making standard HTML source code not viewable. You may consider doing any of the below if they are concerned about your source code.
1. Create the web page in Macromedia Flash or a similar program. The visitor would need to download the Macromedia Flash plug-in and would be unable to view the source code for the flash applet.
2. There are various scripts that will disable the right click feature, preventing the user from saving images or viewing the source. However, this will not protect the source code of your page. For example, Internet Explorer users may still click “View” and “Source” to view the source code of the page, or a user could disable scripts and images can be saved by simply saving the web page to the hard drive.
3. There are several programs that will help scramble your code, making it difficult (not impossible) to read. Again, this is not going to prevent someone from viewing your code.
Why doesn’t my title show up when I click “check it out”?
You’re probably looking at the wrong part of the screen. The Title usually shows up in the Title Bar on the Window, to the left of the minimize/maximize buttons on graphical browsers.
How do I make a thumbnail for my image(s)?
Thumbnails are very useful, but they take a little bit of time to make. All you need is a graphics editing program that has functions to resize an image (sometimes it’s under a function called image attributes). Be advised–when you have made a thumbnail, you will need to save it as something different than the original. Also, you will generally want to link to the larger graphic when you are done.
Here are the steps:
1. Load a copy of the image into your graphics editing program.
2. Determine the ratio the thumbnail to be. (Do you want it to be half the size? One third of the size? One quarter of the size? One tenth of the size?)
3. Find the resize (or change attributes) function of your program. Most programs will recogize a percentage, for example you can type in 25% for height and width if you want the thumbnail to be a quarter of the size. (It it doesn’t do percentages, you can calculate it by multiplying the pixels by the percentage. If you have a graphic that is 400 by 100, and you want it 25% of the size, multiple each measurement by .25. In this case, you’ll get 100 and 25.)
4. Once you are satisfied with the thumbnail, think of a name for the image. Choose Save As and enter that name. (Tip: I like to just add t after the image name. For taco.jpg I’d use tacot.jpg)
5. Upload the image to your site, and edit your HTML to load the new image name with the new, smaller size. If you wish, you can link to the larger image around the image.
Example: You have taco.jpg which is 400 pixels wide and 100 pixels high. You made a thumbnail of it called tacot.jpg, which is now 100 pixels wide and 25 pixels high. After you have both images uploaded, here’s the code:
<a href=”taco.jpg”><img src=”tacot.jpg” width=100 height=25 border=0 alt=”click for larger taco”></a>
You’ll find border=0 to be helpful in eliminating a link-colored box around your thumbnail.
What is the difference between the HTML form methods GET and POST?
The method parameter specifies which method the client is using to send information to the WEB server. The method determines which parameter you will find the CGI request data in:
* POST – post_args
* GET – httpargs
How do I rename all the files from .htm to .html after copying them from a PC to a UNIX machine?
UNIX’s mv (`move’) command won’t handle wildcard filenames. However, there’s a program called htmaddl (for `HTM-add-“L”‘), so you can login and type htmaddl. This will rename all .htm files to .html
If you haven’t got this program on your UNIX machine, you can type it into a file called htmaddl:
for f in *.htm; do
base=`basename $f .htm`
mv $f $base.html
After saving it and exiting your editor, make it executable by typing the command
chmod ugo+x htmaddl
Best of all, move it into your ~/bin directory, or ask your WebMeister to put it in /usr/local/bin so everyone can use it.
How do I put sounds for older versions of Internet Explorer?
For older versions of Internet Explorer, this technique was used <BG SOUND=”sound.ext”>.
Can I use any HTML in the box?
Yes. Any HTML tag that your browser supports will work in the box. So you can carry tags from chapters to chapters and mix and match…
How to transferring user to new web page automatically?
You will need to use the below meta tag.
<META HTTP-EQUIV=”Refresh” CONTENT=”2″; URL=”http://www.yourname.com”>
Placing the above tag in your <HEAD></HEAD> will load yousite.com in 2 seconds.
Changing the 2 value on CONTENT=”2″ to another value will increase or decrease the delay until loading the new page.
I’m trying to `include’ a HTML document in another document…Is there a way to do this?
Yes, there are several ways to do this. But remember, HTML is not a programming language – it doesn’t have `directives’: it’s a markup language, so trying to compare it to C or Pascal is not going to be very meaningful.
SGML already provides the standard way to do this, using an entry in the DocType Declaration for a file:
<!doctype html public “-//IETF//DTD HTML 3.0//EN” [
<!entity foo system “bar.html”>
and then later when you want to include the file
This is the General Entity mechanism used universally in normal SGML work and does exactly what is wanted, with the added benefit that you can have multiple occurrences of &foo; if you need to include some text at more than one place. Unfortunately none of the browsers except Panorama support it, basically because very few of the programmers who write browsers bothered to read up on what can be done.
* The second way is to use the facilities of your server. This has to be enabled by someone with access to the server configuration files (ask your WebMeister). For example, the NCSA server lets you embed a command inside an SGML comment:
<!–#exec cmd=”cat myfile.html”–>
Provided this occurs in a file with a special file type (eg .shtml, and this is what has to be specified in the server configuration), the server will parse the file and send out the result of the command embedded in the document.
* There is in fact a vastly easier way to do this. SGML provides a PI mechanism (Processing Instruction) in the form:
SGML/HTML couldn’t care what you put inside (except it must not, for obvious reasons, contain the `>’ character!). This would be a great way to specify a page break, for example: suppose you were processing an SGML file using PostScript, you could say <?showpage>…but again, none of the browsers except Panorama support this, again because they guys who write them have never bothered to actually read up on how SGML works.