Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #37057

Re: Clearing/Writing a daughter window ?

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 <PointedEars@web.de>
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> (permalink)
References <2e2a80c3-e3bb-4e10-8be1-48c21f76f441@googlegroups.com> <n6pu9j06ak6h$.12cebyy4gv9a7$.dlg@40tude.net>
Reply-To Thomas 'PointedEars' Lahn <cljs@PointedEars.de>
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+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v
Face iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg==
Xref csiph.com comp.lang.javascript:37057

Show key headers only | View raw


JJ wrote:

> 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: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Clearing/Writing a daughter window ? dr.j.r.stockton@gmail.com - 2019-08-03 10:46 -0700
  Re: Clearing/Writing a daughter window ? "R.Wieser" <address@not.available> - 2019-08-04 09:47 +0200
  Re: Clearing/Writing a daughter window ? JJ <jj4public@vfemail.net> - 2019-08-06 00:32 +0700
    Re: Clearing/Writing a daughter window ? dr.j.r.stockton@gmail.com - 2019-08-06 04:13 -0700
      Re: Clearing/Writing a daughter window ? JJ <jj4public@vfemail.net> - 2019-08-07 21:27 +0700
    Re: Clearing/Writing a daughter window ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-08-08 15:00 +0200

csiph-web