简体   繁体   English

禁用converse.js的登录和注册选项卡,并将converse.js与openfire连接

[英]Disabling login and register tab of converse.js, and connecting converse.js with openfire

I am a beginner and using the plugin for the first time. 我是初学者,是第一次使用该插件。 I am working on the converse.js plugin for my website's chat application. 我正在为我的网站的聊天应用程序开发converse.js插件。 Since I have a login for the users, I don't want them to relogin on the converse.js chat. 由于我已经为用户登录,所以我不希望他们在converse.js聊天中重新登录。 Can someone please guide me as to what exactly needs to be done? 有人可以指导我到底需要做什么吗? I tried hiding the divs but only a part of it gets hidden (for the code i have provided only login and register tabs gets hidden). 我尝试隐藏div,但是只有一部分被隐藏(对于我提供的代码,只有登录和注册选项卡被隐藏了)。 I need access the inner elements of the plugin so that whenever the page is loaded it makes a connection directly. 我需要访问插件的内部元素,以便无论何时加载页面,它都将直接建立连接。 I am using openfire. 我正在使用openfire。

 <!DOCTYPE html> <html lang="en"> <head> <title>Converse.js</title> <meta charset="utf-8"> <link rel="stylesheet" type="text/css" media="screen" href="css/converse.min.css"> <script src="js/converse.min.js"></script> <script> function showhide() { var div = document.getElementById("controlbox-tabs"); if (div.style.display !== "none") { div.style.display = "none"; } } </script> </head> <body onload="myFunction()"> <button id="button" onclick="showhide()">Click Me</button> <button onclick="myFunction()">Delete uls</button> </body> <script> require(['converse'], function(converse) { converse.initialize({ auto_list_rooms: false, auto_subscribe: false, prebind: false, keepalive: true, bosh_service_url: 'https://conversejs.org/http-bind/', // Please use this connection manager only for testing purposes hide_muc_server: false, i18n: locales.en, // Refer to ./locale/locales.js to see which locales are supported prebind: false, show_controlbox_by_default: true, roster_groups: true, allow_contact_requests: false }); }); </script> <script> function myFunction() { var list = document.getElementById("controlbox-tabs"); list.removeChild(list.childNodes[1]); } </script> </html> 

Hiding the divs selectively is not the correct way to approach the problem. 有选择地隐藏div不是解决问题的正确方法。
The real solution to login the user into website AND chat is to 将用户登录到网站并进行聊天的真正解决方案是

set up a BOSH session on your server, which converse.js can then connect to once the page loads. 在您的服务器上设置一个BOSH会话,然后在页面加载后converse.js可以连接到该会话。

Please refer to the Converse.js documentation for single session support: 请参考Converse.js文档以获取单会话支持:
https://conversejs.org/docs/html/setup.html#session-support https://conversejs.org/docs/html/setup.html#session-support

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM