Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

widget inbuilt updater



Hi,

I'm trying to code an "updater" alert into my widget. If the widget is out of date (it compares it's version to a version number on a server) then it displays an alert. So far I can display the alert but removing of the alert when the current version is to date does not work. Need help.

Here is my HTML code

<HTML>

<head>

<style>
	@import "widget.css";
</style>
<script language="JavaScript" src="script.js"></script>

</head>

<body>



<!-- windows media player plugin -->
<div id="front" onclick="swapDivs('front','behind','ToBack');">
<img src="Default.png">
</div>

<span class="widget">
<embed type="application/x-mplayer2" 	
			WIDTH=110
			HEIGHT=26
			AutoStart=0
			ShowPositionControls=0
           	ShowDisplay=0
            	ShowStatusBar=0
            	ShowTrackbar=0
            	src="http://www.media.asx";
</embed>

<!-- windows media player plugin -->


<!-- update feature -->
<a id="updateLink" href="javascript:openLink('http://site/ widgets/');" style="text-decoration: none; display: block;">
<div id="newUpdate">
New Update<br />Available!
</div>
</a>
<!-- update feature -->


		
</span>


</body>

</html>




Here is my Javascript code




var currentVersion = "1.0";

function checkForUpdate(){

var updateRequest = new XMLHttpRequest();
updateRequest.onreadystatechange = nullFunction;
updateRequest.open("GET", "http://site/widgets/updaters/ update_v.txt", false);
updateRequest.send(null);


	var updateRequestText = updateRequest.responseText;
	
	if(updateRequestText == (currentVersion)){
		document.getElementById('newUpdate').style.display = 'none';
	}

}

function openLink(url){
	if(window.widget){
		closeDesc();
		widget.openURL(url);
	}
	else{
		window.location = url;
	}
}


_______________________________________________ Do not post admin requests to the list. They will be ignored. Dashboard-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.