Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #37057
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Clearing/Writing a daughter window ? |
| Date | 2019-08-08 15:00 +0200 |
| Organization | PointedEars Software (PES) |
| Message-ID | <1865052.oMNUckLgyt@PointedEars.de> (permalink) |
| References | <2e2a80c3-e3bb-4e10-8be1-48c21f76f441@googlegroups.com> <n6pu9j06ak6h$.12cebyy4gv9a7$.dlg@40tude.net> |
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
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