Post Reply 
Nov. 11, 2005, 09:58 PM
Post: #1
One feature I have missed in IE which Opera has and which can be added to Firefox via an extension is Paste and Go. Paste and go for those who do not know allows one to paste a URL into the supporting browsers address bar and then go to that site. I have searched the web to no avail for an IE add-on which adds this feature so I decided to create my own.

The following filter embeds a script in the pages you visit which implements a paste&go-like functionality for IE6 in two steps - copying the url and pressing F12 to navigate to the site. When the script is loaded it defines the function keyGo and attaches it to the document object as an onkeydown event listener. After it has loaded it will run keyGo but ignore every key except F12. If the F12 key (key code 123) was pressed it will grab the data from the Windows clipboard and attempt to validate it using a regular expression. If the CB data represents a valid URI then the script will navigate to the supplied URL or otherwise alert you that the CB data is invalid. It does not work with mailto URIs but I may implement that next.

Your IE6 security settings may not allow the script to be loaded or to run successfully when loaded. The following is therefore required to ensure the script runs error free.

1) local.ptron must be in your Internet Zone. If you added it to another zone you will need to remove it.
2) Active Scripting must be enabled or set to Prompt in the Internet Zone.
3) Allow paste operations via script must be enabled or set to prompt (I recommend prompt).

If you have done this and it still doesn't work then it could be that one of your filters injects a script which redefines Javascript objects and or methods. If that is the case you will have to fix it yourself.

Another caveat is that depending on your IE config the script will only run at sites in the Internet Zone. I will add a header filter later which will make the keyGo script appear as if it is in the same domain/zone as the current page. That will allow the script to work in your Trusted zone.

Other Browsers.

The methods used in the keyGo script are not supported by non-IE browsers. To prevent them from attempting to load and run the script I have set its type attribute to "text/JScript" which only IE recognizes. Other browsers will simply ignore the script tag.


Copy the keygo.js file to the html folder within your Proxo folder and merge the filter into your config.

Name = "Insert keyGo! Script"
Active = TRUE
URL = "$TYPE(htm)"
Limit = 11
Match = "(^(^<!--\shd\s-->))"
Replace = "<script src="http://local.ptron/keygo.js" type="text/JScript"></script>\n$STOP()"

function keyGo() {
if (window.event.keyCode!=123) return true;
var url=decodeURI(window.clipboardData.getData('Text'));
var tested;
var regex=/^(?:(?:ftp|https?):\/\/)?(?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)+(?:com|edu|biz|org|gov|int|info|mil|net|name|museum|coop|aero|[a-z][a-z])\b(?:\d+)?(?:\/[^;"'<>()\[\]{}\s\x7f-\xff]*(?:[.,?]+[^;"'<>()\[\]{}\s\x7f-\xff]+)*)?/
(tested)?window.location.href=url:window.alert('The data in the clipboard is not a valid URI.');

Attached File(s)
.zip (Size: 773 bytes / Downloads: 443)

Get hpHOSTS!
Add Thank You Quote this message in a reply
Post Reply 

Messages In This Thread
keyGo! - hpguru - Nov. 11, 2005 09:58 PM

Forum Jump: