# How to prevent breaking out of iframed chat room

**URL:** <https://forums.rocket.chat/t/how-to-prevent-breaking-out-of-iframed-chat-room/11638>\
**Category:** Community Support\
**Created:** [July 14, 2021, 2:30pm UTC](https://forums.rocket.chat/t/how-to-prevent-breaking-out-of-iframed-chat-room/11638 "2021-07-14T14:30:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MindtoEye](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/mindtoeye/32/440_2.png) [@MindtoEye](https://forums.rocket.chat/u/MindtoEye)\
**Post date:** [July 14, 2021, 2:30pm UTC](https://forums.rocket.chat/t/how-to-prevent-breaking-out-of-iframed-chat-room/11638/1 "2021-07-14T14:30:29Z")

</div>

### Description

I’m working on a task where we want to provide Rocketchat as a discussion task for students in a language course. We have everything setup and working fine. We create a dummy account, log them in and join a custom created channel. All this works well and the chat looks great in our course page.

However, there are a number of ways in which a student can break out of the chat channel and land in the rocket chat main page.

1. One such way is for them to right click in the rocketchat iframe and choose ‘Back’.

2. Another way is when a student creates a reply to an initial comment and then when the reply is entered and the window on the right side closed the main window’s list of other chat channels appears.

It is very important to us to keep students only in the chat channel and only there. Are there steps I need to take to ensure this? If we can’t prevent this then rocketchat is useless for our purpose.

### Server Setup Information

We’re always running the latest rocket chat docker image. We have an intermediate Java servlet that is the middleware that manages rocket chat and does things like create accounts and channels.

### Any additional Information

We have every other setting configured to only show the chat window and nothing but the chat window, which at least on the surface seems to work.

---

<div class="post-metadata">

**Author:** ![john.crisp](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/john.crisp/32/2711_2.png) [@john.crisp](https://forums.rocket.chat/u/john.crisp)\
**Post date:** [July 14, 2021, 4:22pm UTC](https://forums.rocket.chat/t/how-to-prevent-breaking-out-of-iframed-chat-room/11638/2 "2021-07-14T16:22:07Z")

</div>

Hi.

> [@MindtoEye](#):
>
> However, there are a number of ways in which a student can break out of the chat channel and land in the rocket chat main page.

Good question!

Do either of these help?

> **[Embedded Layout](https://developer.rocket.chat/customize-and-embed/embedded-layout)**

> **[Adding a Rocket.Chat chat room to your web app](https://developer.rocket.chat/customize-and-embed/iframe-integration/adding-a-rocket.chat-chat-room-to-your-web-app)**

If not I’ll have to go and ask.

> [@MindtoEye](#):
>
> We’re always running the latest rocket chat docker image.

As a FYI that isn’t really a great idea - there have been a number of instances where ‘latest’ tag was not updated correctly… in production you really should use a fixed version and upgrade when you are sure it is the right thing to do.

---

<div class="post-metadata">

**Author:** ![MindtoEye](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/mindtoeye/32/440_2.png) [@MindtoEye](https://forums.rocket.chat/u/MindtoEye)\
**Post date:** [July 14, 2021, 9:09pm UTC](https://forums.rocket.chat/t/how-to-prevent-breaking-out-of-iframed-chat-room/11638/3 "2021-07-14T21:09:54Z")

</div>

Hoi there,

The first link you gave is what I’ve been using mostly and it’s the note at the end that’s the clincher:

_Note: If you want to stop users from accessing other channels, embedded layout alone will not work, since the user could change the URL of the embedded view via browser tools. For that you should edit the user permissions so they can’t see other channels_

That seems to work in the sense that users can’t access channels they shouldn’t be allowed to. But they can still bring up the total list of channels we joined them in, plus other main window features. Ideally we prevent students from getting there as well, so literally just the chat window.

(Thanks for the docker tip, that helps a lot)

---

<div class="post-metadata">

**Author:** ![john.crisp](https://sea1.discourse-cdn.com/flex021/user_avatar/forums.rocket.chat/john.crisp/32/2711_2.png) [@john.crisp](https://forums.rocket.chat/u/john.crisp)\
**Post date:** [July 15, 2021, 8:58am UTC](https://forums.rocket.chat/t/how-to-prevent-breaking-out-of-iframed-chat-room/11638/4 "2021-07-15T08:58:00Z")

</div>

Let me check - I think you can do it but not sure how technically.

Need to ask the question.
