简体   繁体   中英

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. Since I have a login for the users, I don't want them to relogin on the converse.js chat. 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). 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.

 <!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.
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.

Please refer to the Converse.js documentation for single session support:
https://conversejs.org/docs/html/setup.html#session-support

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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