Outside Program Links Spawn new Browser Tabs Problem

I got a query regarding the fact that an email link will create a new tab when clicked on instead of using the open tab. If there are a lot of messages to open this can create a problem.
I have looked into this multiplying tab situation. This is actually something that there is no way of controlling in email or on websites. It is totally a function of the browser itself. There is a way for the user to control this behavior in Firefox and IE. In IE do the following:

tools>internet options>general>settings

Then click the radio circle for “open links from other programs in the current window”.

Unfortunately, near as I can tell Chrome has no controls for this. Although there may be some apps that can be added that will help control tab and window openings, or a more recent version or update may have corrected this problem. Google Chrome simply defaults to opening a new tab or window every time a link is called from an outside program. In my investigations there were many
complaints to Google about this behavior.

No Comments

How to Force Browser to See New Favicon

INCOMING!

My new favicon, writ large.

I have been working for the last month and a half on my new website www.dizink.com. It is all about sending messages in disappearing ink. In any case, I created a new favicon for it. When I went to the browser, it did not show up. This is, of course, because the browser caches the favicon. There are many suggestions on how to force the browser to see the new favicon. Everything from refresh, f5, to reboot. I found that none of these had any effect. However, there is a simple solution you can add to the webpage that will actuall force ALL browsers to see the new favicon.

<link rel=”shortcut icon” href=”http://www.yoursite.com/favicon.ico?v=2” />

You need the v=2 on this or some semblance of it. Anyway, it is a useful little trick.

No Comments

JavaScript to Control MaxLength in TextArea

I spent a few hours yesterday trying to create a javascript that would control the maximum length entered onto a form by a user in real time. What I wanted to do was to count the characters put into a textarea and notify the user of his total, and at the same time truncate all inputs to 150 characters. Something like what Twitter does, but not quite. Anyway, this is more difficult than it sounds.

The problem is that if you cut and paste using the mouse, none of the events in the text area box will trigger the maxLength javascript. (onpaste is useless for this because it occurs BEFORE the paste actually occurs and accessing the clipboard is impossible except in IE.) Admittedly, my solution is not as elegant as I would like. Here is the salient part of the form:

<form name=”dothing” action=”../cgi/doit.php” method=”post”>
<table border=”0″ cellpadding=”10″ align=”center” id=”get_message” onmouseover=’return maxLength(document.dothing.dmessage,”150″);’><tr><td>
<strong>Message – 150 characters or less:</strong></td><td><textarea id=”dmessage” name=”message” rows=”4″ cols=”40″ maxlength=”150″ onchange=’return maxLength(this,”150″);’ onKeyUp=’return maxLength(this,”150″);’ onblur=’return maxLength(this,”150″);’onmouseup=’return maxLength(this,”150″);’></textarea><br /><span id=”char_num”>150 characters allowed.</span></td></tr><tr><td>
<strong>Click to Send:</strong></td><td><p align=”center”><input type=”submit” name=”odsubmit” value=”Submit” /></p></td></tr>
</table>
</form>

Well, there might have been a bit of overkill on the events that call on the maxLength function. But I figured that it didn’t hurt to cover all the bases. To deal with the cut and paste problem, I incuded a mouseover call of the maxLength function on the table. I suppose you could do it for even wider areas. In any case, this does prevent the user pressing the “Submit” button with excessive text in the box and at least gives some warning. Here is the JavaScript:

function maxLength(field,maxChars)
{
var $string_length = field.value.length;
var $length_over = $string_length – maxChars;
if($length_over >= 0)
{
field.value = field.value.substring(0, $string_length – $length_over);
}
document.getElementById(‘char_num’).innerHTML = field.value.length;
}

Pretty simple for several hours of research and a bit of hack, but there it is.

No Comments

Find the Width of a Window

Do you need to find the width of a window? If you want your page to be dynamic and be able to adjust for the width of a window, html on its own will do some of that, but it will not adjust image sizes and multiple columns can pose a problem. There is some JavaScript that will allow the code to get the info you need:

<script>
var $window_width = document.body.offsetWidth;
window.alert(“The width of this window is: ” + $window_width);
</script>

Of course, you probably will not want to be telling visitors this info in an alert box. But this gives you the basic command to do what needs to be done.

No Comments

How to Add a New Domain to Server

I just registered a new domain and have plans for a new website. The process of doing this is not as intuitive as you might think. Here is a brief summary of what to do:

1. Choose a Domain Name: This is probably the hardest part of creating a website. My personal belief is that, except under exceptional circumstances, the domain must be a dot com. Using dot net or biz or whatever looks like you couldn’t get a dot com and implies either a lack of imagination or a lack of funds or both. My experience is that any domain with two English dictionary words or less or five letters or less is probably taken or someone wants to sell it to you for a couple of Gs. I try to find a name that describes what I want, but also conveys a hip tone plus is relatively short. This is not easy. I spent a whole weekend coming up with my latest domain name. The domain name I chose is dizink.com. I will leave it to your imagination – for now - to guess what it is for.

2. Register Domain: The domain registration companies make this as easy as possible. I use NameCheap. They have a great interface and twenty-four hour chat customer service. The staff seems pretty knowledgeable and are always helpful. I generally use their interface for the search. I am not afraid of them registering my domain queries for themselves and then trying to sell them back to me later as another registrar famously did to customers some few years ago. In any case, they would go broke if they tried that scheme on me.

Domain Navigation

Domain Navigation

3. Modify the Domain Info: The domain info must be pointed to the correct server host. On NameCheap, this is pretty simple. Click on the domain and then using the right column navigation click “Domain Name Server Setup”.  This will bring you to a screen allowing you to make changes. I have found at namecheap that during the initial registration you actually think that you have pointed this to the right place. But often you haven’t or the proper settings have not been saved somehow. I will blame myself and not namecheap on this one. In any case, this step seems necessary, because if you try to do step 4 first you will throw an error. Now you will need to enter the appropriate info on the form. If you have a namecheap server, which I do, then click the radio button that reads “Use Namecheap Hosting DNS Servers” and then hit “Save Changes. (See image below.) If not, you will have to get the “custom DNS server name from your webhost”. I have found this to be somewhat problematic from some webhosts. I had to dig quite deep in GoDaddy’s documentation to find the correct server names. But that was a few years ago, they may have improved their system since then.

Modify Domain Form on NameCheap

4. Add Domain to Server: On Cpanel under “Domain” on the user interface panel, click on “Addon Domain”. This will bring you to the screen shown below. Simply fill in the form. Note that for “New Domain Name” be sure to fill in the type of domain (.com or .net etc.) as well as the name. The next few lines should auto fill out. Choose a password then hit “Add Domain”. You should be all set to go.

Add Domain Form

Add Domain Form on Cpanel

5. Test: I usually upload an index.htm file that just says test. Now type the domain into your browser. It should read “test”. Now you know you did the job correctly.

No Comments

Back to Soldering Copper Pipes

Well, I know it has been a while and reading the same post day after day on a blog can get rather old. Not that I am suffering under any delusions that people were flocking to mcgelligot.com every day for the last two years or so to see I had not written a post.

I am back. Mainly because I lost my current job; the lumber yard I worked at closed its doors. It was a sad day for many, but I was not too sad because I saw (see) it as an opportunity to get back to my first love which is creating websites and their content. In the week or so I have been back, I have applied for unemployment, put in a few job applications and created several web pages. The most recent page was made for InDepthInfo.

As you may remember from waaaay previous posts, I had vowed to get into video. I made some ventures into that realm, but I have decided to pursue that aspect more assiduously. Thus, as I was working on my building in downtown Harbor Beach, I took some pics and video of what I was doing (soldering copper pipe) and created the webpage, How to Solder a Copper Pipe. It includes an accompanying video.

The quality of the video is not all I could hope, but it is a step in the right direction.

No Comments

Nerdy Genius

My son has decided that he wants to go into the business of creating websites. He is thirteen and has been assiduously reading programming manuals for JavaScript, Php and the like. He has expressed such a keen desire to advance in this field that I told him to pick out a domain name and I would register it for him. Thus, my son chose NerdyGenius. He is indeed a genius, at least in the eyes of his old father. The site is quite basic at this point, but I forsee it growing. He is experimenting with various commands and using it to highlight some of the games he has developed using the GameMaker platform. Please visit and send the boy some encouragement.

No Comments