# Event when htmlviewer page opens a popup

**URL:** <https://forum.xojo.com/t/event-when-htmlviewer-page-opens-a-popup/84380>\
**Category:** Targets\
**Created:** [February 23, 2025, 3:18pm UTC](https://forum.xojo.com/t/event-when-htmlviewer-page-opens-a-popup/84380 "2025-02-23T15:18:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timo\_Ruohomaki](https://forum.xojo.com/user_avatar/forum.xojo.com/timo_ruohomaki/32/2264_2.png) [@Timo\_Ruohomaki](https://forum.xojo.com/u/Timo_Ruohomaki)\
**Post date:** [February 23, 2025, 3:18pm UTC](https://forum.xojo.com/t/event-when-htmlviewer-page-opens-a-popup/84380/1 "2025-02-23T15:18:30Z")

</div>

Quick question of the standard htmlviewer: Is there a way to get out an event whenever the loaded page opens up a popup? It seems that DocumentComplete is not called before the popup is taken care of, e.g. when it asks for a permission to accept cookies or whatever.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [February 23, 2025, 3:41pm UTC](https://forum.xojo.com/t/event-when-htmlviewer-page-opens-a-popup/84380/2 "2025-02-23T15:41:04Z")

</div>

You control what is put into the htmlviewer. What sort of popup are you talking about?

---

<div class="post-metadata">

**Author:** ![Timo\_Ruohomaki](https://forum.xojo.com/user_avatar/forum.xojo.com/timo_ruohomaki/32/2264_2.png) [@Timo\_Ruohomaki](https://forum.xojo.com/u/Timo_Ruohomaki)\
**Post date:** [February 23, 2025, 3:54pm UTC](https://forum.xojo.com/t/event-when-htmlviewer-page-opens-a-popup/84380/3 "2025-02-23T15:54:37Z")

</div>

As an example, if htmlviewer loads [www.google.com](http://www.google.com), it will open up a popup asking to accept cookies. My current project is a digital signage application so looking for a way to identify situations where pages are not displayed.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [February 23, 2025, 4:03pm UTC](https://forum.xojo.com/t/event-when-htmlviewer-page-opens-a-popup/84380/4 "2025-02-23T16:03:23Z")

</div>

An htmlviewer is not a browser, and as far as I know doesn’t do cookies. Also I would have expected that whatever the htmlviewer displays is to be found somewhere as part of the document you are loading. So I don’t understand how that could be preventing the documentloaded event.

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [February 23, 2025, 4:44pm UTC](https://forum.xojo.com/t/event-when-htmlviewer-page-opens-a-popup/84380/5 "2025-02-23T16:44:30Z")

</div>

Yes, HTMLViewers retain cookies.

When JavaScript or a Link opens a new Window (`target=_blank`), [there is an event for that](https://documentation.xojo.com/api/user_interface/desktop/desktophtmlviewer.html#desktophtmlviewer-newwindow). That is the common definition of Popup and what is leading to some confusion for me. Cookie consent overlays are generally not new windows, they are part of the webpage. There isn’t an event for those.

---

<div class="post-metadata">

**Author:** ![Timo\_Ruohomaki](https://forum.xojo.com/user_avatar/forum.xojo.com/timo_ruohomaki/32/2264_2.png) [@Timo\_Ruohomaki](https://forum.xojo.com/u/Timo_Ruohomaki)\
**Post date:** [February 23, 2025, 5:17pm UTC](https://forum.xojo.com/t/event-when-htmlviewer-page-opens-a-popup/84380/6 "2025-02-23T17:17:32Z")

</div>

Thanks, yes I guess overlays are getting more common with modern frontend frameworks anyway. An excess time between DocumentBegin and DocumentComplete might be a workaround as a client-side timeout.
