# Find out if my code runs inside a notebook or jupyter lab?

**URL:** <https://discourse.jupyter.org/t/find-out-if-my-code-runs-inside-a-notebook-or-jupyter-lab/6935>\
**Category:** General\
**Created:** [November 28, 2020, 10:18pm UTC](https://discourse.jupyter.org/t/find-out-if-my-code-runs-inside-a-notebook-or-jupyter-lab/6935 "2020-11-28T22:18:52Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![jasongrout](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.jupyter.org/jasongrout/32/371_2.png) [@jasongrout](https://discourse.jupyter.org/u/jasongrout)\
**Post date:** [December 3, 2020, 11:03pm UTC](https://discourse.jupyter.org/t/find-out-if-my-code-runs-inside-a-notebook-or-jupyter-lab/6935/8 "2020-12-03T23:03:11Z")

</div>

> [@hx2A](#):
>
> Only Jupyter looks for it, and only when the front-end is capable of displaying HTML.

Quick clarification - it is not that smart. Using the IPython display method to show such an object will always generate the HTML, regardless of what frontend is being used. In general, the kernel does not know what frontends will be displaying the information, so it cannot make such decisions.

---

_[View the full topic](https://discourse.jupyter.org/t/find-out-if-my-code-runs-inside-a-notebook-or-jupyter-lab/6935)._
