FWIW, the following sample code works in both Sigil and iBooks.
Code:
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
//<![CDATA[
alert("screen width=" + screen.width);
//]]>
</script>
</head>
<body>
</body>
</html>
Also, a workaround to editing javascript files in Sigil is to give the file a .css extension and put it in the Styles folder. Both iBooks and Sigil are happy with this.
-Bill