2009-04-09

ubuntu - firefox cannot resolve URL with telnet:// protocol

In Firefox, when clicking on a URL link with "telnet://", firefox browser would pop up an error message "Firefox doesn't know how to open this address, because the protocol (telnet) isn't associated with any program.". It is due to the browser have not register a helper application to run the URL link with "telnet://". Below are some simple steps to prepare firefox in Ubuntu using xterm to open the URL :
1.  Create a bash script name ~/bin/foxtelnet, with the following commands :
#!/bin/bash
xterm -e telnet ${1##telnet://}


2. Make the bash script executable by running :
chmod 700 ~/bin/foxtelnet


3. In firefox, type :
about:config
in the URL bar.


4. Right click any where on the page and choose "New" --> "String".


5. Paste the value :
network.protocol-handler.app.telnet
as the "preference name" and empty as the new value.


6. Quit & start back firefox browser.


7. Click on the URL with "telnet://" and it should prompt what application to run with the protocol "telnet;//".


8. Browse to the bash script we created in step 1.

Voilla !!!

4 comments:

David said...

Hi im NEW using ubuntu (Linux) and im still having problems opening telnet aplication via url. Im not sure how to make the bash script executable. can you be more specific please.! im typing this command

root@Tatooine:~# chmod 700 ~/bin/foxtelnet
chmod: cannot access `/root/bin/foxtelnet': No such file or directory

and i did this in about:config
Preference Name Status type Value

network.protocol-handler.app.telnet user set string empty

Please correct me if im wrong.
PD: this is web page http://www.cisconet.com/route-server/world_map.html

thanks

David
Costa Rica

monkey said...

David,
The error "chmod: cannot access `/root/bin/foxtelnet’: No such file or directory" refer to it is unable to find the file. Check the location of the script and change the permission accordingly.

mithrandir said...

Your script only works if there is no port in the URL. This might work more reliably.

#!/usr/bin/perl -w

if ($ARGV[0]=~m|(telnet://)?(\S+):(\S+)|o) {
($host,$port)=($2,$3);
exec ('xterm', '-sb', '-sl', '10000', '-e', 'telnet', ${host}, ${port});
}
elsif ($ARGV[0]=~m|(telnet://)?(\S+)|o) {
($host)=($2);
exec ('xterm', '-sb', '-sl', '10000', '-e', 'telnet', ${host});
}

monkey said...

Thanks mithrandir. :)