我只是试图读取谷歌小工具中的用户布尔首选项,但似乎首选项永远不会得到保存,我只能得到任何default_value是。我把它分解成一个非常简单的测试用例。这里是我的测试小工具规范:谷歌小工具布尔首选项似乎不工作
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Gadget to test bool">
</ModulePrefs>
<UserPref name="testpref" display_name="Test Boolean Preference" default_value="true" datatype="bool" />
<Content type="html">
<![CDATA[
<script type="text/javascript">
var prefs = new gadgets.Prefs();
alert(prefs.getBool('testpref'));
</script>
]]>
</Content>
</Module>
我希望看到的是与true
或false
警报在它无论用户在Preferences对话框中选择了。但是,用户的偏好被完全忽略,并未保存,甚至我的默认值也未显示在首选项中。当我为默认值指定true时,首选项复选框保持未选中状态。
我错过了什么?
编辑:我试图在Google Apps Google协作平台启动页面上使用此工具。
此示例似乎适用于iGoogle。当然,现在我觉得*我失去了一些东西。你在其他的小工具容器实施吗? – 2010-10-13 01:11:06
很奇怪!我正在Google Apps Google网站首页上测试此功能,但该功能无效。 – Brad 2010-10-13 16:04:48