Previous Section  < Day Day Up >  Next Section

Hack 86 Hypertext Links to IRC Channels

figs/beginner.gif figs/hack86.gif

Looking for an easy way to get people to join your channel? Add IRC hyperlinks to your web pages.

One way of making your IRC channel easily accessible is to increase the number of ways people can join it. Creating an HTML hyperlink that points to your IRC channel is a convenient way of letting people know the server details and channel name.

To be able to use these links, you must have an IRC client installed that has chat link support enabled. If you have the ChatZilla IRC client installed, you can expect to be able to just click on IRC links to connect to the server and join the specified channel. In some other clients, such as mIRC, you will need to enable support for chat links, as shown in Figure 14-1.

Figure 14-1. Enabling chat links in mIRC
figs/irch_1401.gif


14.2.1 HTML IRC Links

IRC links are specified like any other hyperlink, but with irc as the protocol. Valid IRC links look like this:

<a href="irc://irc-server:port/channel?key>Click to join</a>

Each IRC URL can be broken up into four parts:


irc-server

The IRC server to connect to.


port

The port number to connect to. This is optional and must be preceded by a colon character if you use it. If you do not specify a port number, the default of 6667 will be used.


channel

When your IRC client connects to the server, it will automatically join this channel. Note that you must not include the # character.


key

If the channel is password protected, you can specify the key. This is also optional and must be preceded by a question mark character.

14.2.2 Example Links

If you just want people to be able to connect to your IRC network in a hurry, you needn't bother specifying a channel to join:

<a href="irc://irc.your-irc-server.com">Connect to my IRC server</a>

If you have a channel on the freenode IRC network (irc.freenode.net) called #mychan and it has a key of "password", you could let web users visit your channel by providing the following link:

<a href="irc://irc.freenode.net/mychan?password">Join my private channel</a>

The most typical example you will see in use on the Web would be a link that points at a public channel, such as:

<a href="irc://irc.freenode.net/irchacks">IRC Hacks Channel</a>

Clicking on this hyperlink will launch your IRC client and join the #irchacks channel on the freenode IRC network.

Alex North

    Previous Section  < Day Day Up >  Next Section