0

我有以下弹出窗口的代码:

<script type="text/javascript">
function post_to_url(path, params, method) {
    popup = window.open("", "Chat", "scrollbars=no ,resizable=yes");
    method = method || "post"; // Set method to post by default if not specified.

    // The rest of this code assumes you are not using a library.
    // It can be made less wordy if you use one.
    var form = popup.document.createElement("form");
    form.setAttribute("method", method);
    form.setAttribute("action", path);

    for (var key in params) {
        if (params.hasOwnProperty(key)) {
            var hiddenField = popup.document.createElement("input");
            hiddenField.setAttribute("type", "hidden");
            hiddenField.setAttribute("name", key);
            hiddenField.setAttribute("value", params[key]);

            form.appendChild(hiddenField);
        }
    }

    popup.document.body.appendChild(form);
    form.submit();
}

function login_to_chat() {
    var path = "/resources/livehelperchat/lhc_web/index.php/site_admin/chat/chattabs/";
    var params = {
        'lhc_user': '<?=$_SESSION['
        lhc_user '];?>',
        'lhc_password': '<?=$_SESSION['
        lhc_password '];?>'
    };
    post_to_url(path, params, "POST");
}
</script>

我有一个链接可以打开这个弹出窗口并调用 login_to_Chat():

<a href="javascript:login_to_chat();" title="">Support Chat</a>

在 IE 中它工作正常 - 窗口显示并且我发布的页面正确加载。它在 Chrome 中不起作用 - 显示弹出窗口,但没有加载任何内容。

有什么建议么?

4

0 回答 0