BrowserManager Returns null - Flex 4.5

来源:互联网 发布:手机能注册淘宝店铺吗 编辑:程序博客网 时间:2024/06/06 09:46

Summary: 由于Flex做客户端的系统要与JSP客户端的系统交互,选择用BrowserManager 来接受参数。 突然有一天发现,BrowserManager 接受不到任何参数了,无论浏览器的地址栏输入什么,在Flex端都读不到任何数据。

在google上找了一下,找到了解决办法:http://stackoverflow.com/questions/6784494/browsermanager-returns-null-flex-4

最详细的就是这篇文档了,http://flexperiential.com/2010/05/06/browsermanager-returns-null/


对照生成的html,发现 这句话 

<script src="history/history.js"></script>

被注释掉了。


把这句话放开,问题就解决了。 原来BrowserManager类是用history.js这个JS类来读取浏览器地址的内容的。

  /* Get the current location hash excluding the '#' symbol. */    function getHash() {       // It would be nice if we could use document.location.hash here,       // but it's faulty sometimes.       var idx = document.location.href.indexOf('#');       return (idx >= 0) ? document.location.href.substr(idx+1) : '';    }    /* Get the current location hash excluding the '#' symbol. */    function setHash(hash) {       // It would be nice if we could use document.location.hash here,       // but it's faulty sometimes.       if (hash == '') hash = '#'       document.location.hash = hash;    }    function createState(baseUrl, newUrl, flexAppUrl) {        return { 'baseUrl': baseUrl, 'newUrl': newUrl, 'flexAppUrl': flexAppUrl, 'title': null };    }