# 我能在 head\_tag 中显示模态框吗？

**URL:** <https://meta.discourse.org/t/can-i-show-a-modal-from-head-tag/289836>\
**Category:** Development\
**Created:** [2023年九月11日 08:03 UTC](https://meta.discourse.org/t/can-i-show-a-modal-from-head-tag/289836 "2023-09-11T08:03:48Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)\
**Post date:** [2024年二月5日 13:10 UTC](https://meta.discourse.org/t/can-i-show-a-modal-from-head-tag/289836/5 "2024-02-05T13:10:54Z")

</div>

您好 Brandon，

通常我们建议避免使用“head 标签”进行任何复杂的自定义。您应该考虑设置一个基于 Git 的主题。

一旦您设置好了，那么是的，DModal 可能是您需要的。我们这里有一些关于它的文档：

> [@Using the DModal API to render Modal windows (aka popups/dialogs) in Discourse](https://meta.discourse.org/t/using-the-dmodal-api-to-render-modal-windows-aka-popups-dialogs-in-discourse/268304):
>
> Discourse 3.1.0.beta6 ships with a brand new \<DModal\> component-based API. information_source This supersedes the old controller-based API, which is now deprecated. If you have existing modals using the old APIs, check out the migration guide [here](https://meta.discourse.org/t/converting-modals-from-legacy-controllers-to-new-dmodal-component-api/268057). Rendering a Modal Modals are rendered by including the \<DModal\> component in a handlebars template. If you don’t already have a suitable template, check out [Using Plugin Outlet Connectors from a Theme or Plugin](https://meta.discourse.org/t/using-plugin-outlet-connectors-from-a-theme-or-plugin/32727). A simple modal would look someth…

---

_[View the full topic](https://meta.discourse.org/t/can-i-show-a-modal-from-head-tag/289836)._
