Path: csiph.com!weretis.net!feeder7.news.weretis.net!news.roellig-ltd.de!open-news-network.org!news4.open-news-network.org!.POSTED.110.233.197.178.dynamic.wless.lssmb00p-cgnat.res.cust.swisscom.ch!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Clearing/Writing a daughter window ? Date: Thu, 08 Aug 2019 15:00:38 +0200 Organization: PointedEars Software (PES) Lines: 57 Message-ID: <1865052.oMNUckLgyt@PointedEars.de> References: <2e2a80c3-e3bb-4e10-8be1-48c21f76f441@googlegroups.com> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit Injection-Info: news4.open-news-network.org; posting-host="110.233.197.178.dynamic.wless.lssmb00p-cgnat.res.cust.swisscom.ch:178.197.233.110"; logging-data="19480"; mail-complaints-to="usenet@exeter.123backup.de" User-Agent: KNode/4.14.10 X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. On Sat, 3 Aug 2019 10:46:30 -0700 (PDT), dr.j.r.stockton@gmail.com wrote: >> Alternatively, is there a better way of loading sFileDat >> into Wndw, maybe by assignment, so that any previous content >> of Wndw is no longer there (and best, given explicitly >> to the garbage collector)? > > You should call the `document.close()` after you've finished using either > `document.write()` or `document.writeln()`. Once `document.close()` is > called, the next time you call `document.write()` or `document.writeln()` > again, it will rewrite the whole page. i.e. the old page contents is > discarded. That document.write() implicitly calls document.open() is only standardized since HTML5. The safe way is to call child_window.document.open(); before document.write() explicitly. Note however, that this is the crude, outdated way to reset the entire contents of a window; for backwards compatibility, you will have to restore the *entire* document, including the HEAD element. Since the MSHTML and W3C DOMs, there is document.body.textContent = ''; or var body = document.body; var last_child; while ((last_child = body.lastChild)) body.removeChild(last_child); or its MSHTML and W3C DOM Working Draft variant document.body.innerHTML = ''; instead. The latter is probably the only reasonable use for the as-yet proprietary “innerHTML” property if none of the previous variants can be used. > Keep in mind though... That, this only applies to HTML elements. It won't > apply to any previously declared JavaScript variables and functions. If > you want a truly fresh page, navigate the window via its window object. If none of the above approaches suffice, it should be easier to call child_window.location.reload(true); -- PointedEars FAQ: | | Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.