Click here to Skip to main content
15,883,901 members
Articles / Programming Languages / Javascript
Article

Bored by Hotmail?

Rate me:
Please Sign up or sign in to vote.
4.78/5 (66 votes)
26 Oct 20043 min read 147.9K   1K   38   43
A workaround to escape the "Your email message has been idle" when clicking a link in a hotmail message that has been displayed for more than five minutes
  • <a href="/KB/scripting/hotmailworkaround/hotmailworkaround_src.zip"="">Download source files - 1 Kb

Introduction

This idea came up because I was bored by Hotmail's standard behaviour.

Every month I get the newsletter from CodeProject. These emails are pretty lengthy and contains several links. I read them using hotmail in a browser. When I follow one link I study the article for some time(5 min) and then closes the window. Now I want to read the next link in the newsletter but Hotmail gives me a popup-window as seen above stating that "this link has become inactive".

This is wrong, the link is active. CodeProject has not removed it. You can get around this by hitting the Refresh button of the browser but it is very annoying! You don't get around the fact that hotmail replaces the original links in your messages with a URL to one of their servers taking the original link as parameter. This is suggesting that hotmail is logging what links you visit!!!

This is Freakin' Spyware behaviour to me!!!

The Hack

I searched around for away of extending the capabilities of Internet Explorer and I found this article describing a way to <a href="http: msdn.microsoft.com="" workshop="" browser="" overview="" overview.asp?frame="true#Controlling_the_Cont"">Control the Context Menus. Items can be added to the existing context menus of the WebBrowser Control by placing entries in the registry and linking these to URLs that execute script.

To add items to the standard WebBrowser Control context menus, create or open the following key:

HKEY_CURRENT_USER
        Software
            Microsoft
                Internet Explorer
                    MenuExt

Under this key, you create a key whose name contains the text you want displayed in the menu. The default value for this key contains the URL that will be executed. The key name can include the ampersand (&) character, which will cause the character immediately following the & to be underlined

The following registry entry adds an item with the title Open Hotmail Link to the WebBrowser Control context menu and executes the inline script contained in the file c:\hotmail.js.

HKEY_CURRENT_USER
        Software
            Microsoft
                Internet Explorer
                    MenuExt
                        Open Hotmail Link = "file:///c:/hotmail.js"
                        Contexts          = dword:0x20

The "Contexts" DWORD value specifies the context menus in which an item will appear. In this case 0x20 is corresponding to CONTEXT_MENU_ANCHOR, the menu item will only be visible when you right clicked a hyperlink.

Now we have a way of invoking a JavaScript file by right clicking the hyperlink in the hotmail message. Let us consider the format of the hyperlink and restructure it using JavaScript.

"javascript:OpenWin('http://64.4.18.250:80/cgi-bin/linkrd?
_lang=EN&lah=f785aa457196eab7084467d483648024&lat=1098364221
&hm___action=http%253a%252f%252fwww%252ecodeproject
%252ecom%252fjscript%252fhotmailworkaround%252easp
%253fmsg%253d953418%2523xx953418xx');"

The first three lines above is added by hotmail and not of interest to us. The fourth line however contains a parameter called hm___action which is set to the value of the link as it was intended by the person or machine that sent the email.

First we obtain the link that was clicked.

JavaScript
//Obtain the hyperlink clicked
var oSource = external.menuArguments.event.srcElement

var str = new String(oSource.href);

Now the link is scanned for the first occurrence of the string "hm___action=".

JavaScript
//find the index of "hm___action=" in string
var i = str.indexOf("hm___action=", 0);

//if "hm___action=" was found then ...
if (i != -1)
{

//Cut away stuff added by hotmail
str = str.substring(i + 12, str.length-3);

...

}

The indexOf method finds the location of "hm___action=" inside str and tells you where the substring starts. If the string doesn't contain the substring, indexOf returns -1. The index i is then advanced by twelve, which is the number of characters in the string "hm___action=". Since the data of interest is located between i and the end of the string, except the last three chracters, str.length-3, a simple call to the substring method is used to extract it.

The value of str in our example is now.

"http%253a%252f%252fwww%252ecodeproject%252ecom%252f
jscript%252fhotmailworkaround%252easp
%253fmsg%253d953418%2523xx953418xx"

The original link has been URL encoded so lets URL decode it.

JavaScript
str = unescape(str);

After this operation the link is now in its original state before Hotmail meddled with it and all we have to do is to open it in a new browser window

JavaScript
open(str);
Now you can invoke the JavaScript on any link, not just hotmail, but it will only work its magic if the parameter hm___action is found.

Install

In the downloads at top you will receive a zip archive containing two files.

  • hotmail.js
  • hotmail.reg

The hotmail.js should be placed in C: directory. The hotmail.reg should be run to add the correct key and values to the registry. Don't forget to close all browser windows before trying out the hack. I hope it can be off some help. I know the problem bugged the hell out of me.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Sweden Sweden
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralWooHoo!!!! Pin
patnsnaudy1-Dec-04 4:12
patnsnaudy1-Dec-04 4:12 
GeneralRe: WooHoo!!!! Pin
aalo24-Jan-05 21:31
aalo24-Jan-05 21:31 
GeneralReally Nice..... nearly Pin
Roydy3-Nov-04 0:53
Roydy3-Nov-04 0:53 
GeneralRe: Really Nice..... nearly Pin
aalo8-Nov-04 22:22
aalo8-Nov-04 22:22 
GeneralNice, but Pin
skjagini29-Oct-04 16:24
skjagini29-Oct-04 16:24 
GeneralRe: Nice, but Pin
aalo1-Nov-04 1:16
aalo1-Nov-04 1:16 
GeneralGreat work Pin
mbeatini26-Oct-04 2:29
sussmbeatini26-Oct-04 2:29 
GeneralRemaining Characters html'); Pin
Member 334777719-Oct-04 15:22
Member 334777719-Oct-04 15:22 
GeneralRe: Remaining Characters html'); Pin
Boyan N. Rabchev21-Oct-04 2:27
Boyan N. Rabchev21-Oct-04 2:27 
GeneralRe: Remaining Characters html'); Pin
aalo21-Oct-04 3:05
aalo21-Oct-04 3:05 
GeneralRe: Remaining Characters html'); Pin
Anonymous23-Oct-04 21:10
Anonymous23-Oct-04 21:10 
GeneralRe: Remaining Characters html'); Pin
aalo26-Oct-04 3:01
aalo26-Oct-04 3:01 
GeneralMine isnt working Pin
magicmike00728-Sep-04 18:35
magicmike00728-Sep-04 18:35 
GeneralRe: Mine isnt working Pin
aalo28-Sep-04 20:40
aalo28-Sep-04 20:40 
QuestionHow to mass-forward this files? Pin
Dragonlord_kfb21-Sep-04 11:07
Dragonlord_kfb21-Sep-04 11:07 
GeneralYou are Jesus! Hurray. Bill G. owes you money! Pin
John Dresty29-Jun-04 16:57
sussJohn Dresty29-Jun-04 16:57 
QuestionMozilla? Pin
hlaford15-Apr-04 10:31
hlaford15-Apr-04 10:31 
AnswerRe: Mozilla? Pin
aalo15-Apr-04 22:15
aalo15-Apr-04 22:15 
GeneralRe: Mozilla? Pin
aalo16-Apr-04 0:35
aalo16-Apr-04 0:35 
GeneralRe: Mozilla? Pin
aalo7-Jul-04 0:38
aalo7-Jul-04 0:38 
GeneralThanks so much Pin
effalump28-Mar-04 10:25
effalump28-Mar-04 10:25 
I'd just like to thank you for this excellent post; that 'feature' of hotmail always bugged the hell out of me. Even if they are using it as spyware, *why* would they make it time out in this incredibly annoying manner...?!

Thanks again,

Andy
Generalgood!! Pin
Anonymous27-Mar-04 22:52
Anonymous27-Mar-04 22:52 
GeneralOutstanding Pin
Martin mmx26-Mar-04 1:50
Martin mmx26-Mar-04 1:50 
GeneralGreat! Pin
worshiprick22-Mar-04 2:20
worshiprick22-Mar-04 2:20 
Generalfor image anchors it fails Pin
mohanarun21-Mar-04 19:22
mohanarun21-Mar-04 19:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.