# Load Webchat within page Element

By default, the webchat iFrame widget will be added to the bottom of the page `<body>`after all page content. A CSS file is added to the page the widget is loaded on to position and size the iFrame that contains the chatbot.

In order to override this and have the iFrame drawn in a specific place on the page, you will need to update the chatbot embed code to include a `parentEl` item. eg:

```
<script>
  window.openDialogSettings = {
    url: 'https://brian-may.cloud.opendialog.ai',
    user: {
      custom: {
        selected_scenario: '0x420'
      }
    },
    parentEl: "#chatbot"
  };
</script>
```

The `parentEl` needs to be a valid CSS selector for the page - the above will place the iFrame inside the element with ID `chatbot`

NB - even if the chatbot is loaded inside an element, the default CSS is still applied to give the iFrame a fixed position.

Update your page CSS to have control over where the iFrame is positioned on the page and its size:

```
#chatbot>iframe#opendialog-chatwindow {
  position: static;
}
```

The page loaded within the iFrame adds a fixed width and auto margins. To be able to set a height You should overwrite these in a custom CSS sheet and have that loaded via the interface settings:

```
.od-chat-window.iframe {
  margin: 0;
  width: 100%
}

.od-chat-window.iframe.opened {
  margin: 0;
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.opendialog.ai/developing-with-opendialog/webchat/load-webchat-within-a-page-element.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
