Open ssh and telnet from firefox

How to open telnet/ssh sessions from firefox with putty? Simply add following script as application under Edit – Preferences – Applications.

#!/usr/bin/perl
# parse URL
 ($protocol,$host) = split /:\/\//, $ARGV[0];
 ($host,$port) = split /:/, $host;
# validate input
 if ( $protocol !~ /^(telnet|ssh)$/ ||
 $host !~ /^[a-zA-Z0-9][a-zA-Z0-9.-]*$/ ||
 $port !~ /(^[a-zA-Z0-9][a-zA-Z0-9_-]*$|^$)/ ) {
 warn "Invalid URL";
 exit 1;
 }
# if SSH, add -p argument
 if ( $protocol eq "ssh" && $port != '' ) { $port = "-p $port" ; }
# call terminal emulator
 exec("putty -$protocol $host $port");
 exit;

Script taken and modified from tolaris.