Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 40 lines (33 sloc) 1.7 KB
<!DOCTYPE html>
<html>
<head>
<title>your app</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#header").html("Your operating system is: " + os.type());
$("#button").click(function() {
var filepath = (os.type() != 'windows') ? '/etc/hosts' : 'C:\\Windows\\System32\\drivers\\etc\\hosts';
var callback = function (err, data) {
if (err) throw err;
alert(data);
};
fs.readFile(filepath, callback);
});
});
</script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1 id="header"></h1>
</div><!-- /header -->
<div data-role="content">
<a href="#" id="button" data-role="button" data-icon="star">Click to read /etc/hosts file</a>
</div><!-- /content -->
</div><!-- /page -->
</body>
</html>