Questions tagged [document.write]

A DOM Level 2 HTML method that writes a string of text to a document stream opened by document.open().

A DOM Level 2 HTML method that writes a string of text to a document stream opened by document.open().

487 questions
4
votes
2 answers

document.open / document.write not properly clearing the document in chrome -- is this a bug in chrome?

I am writing to an iframe via document.write then trying to overwrite the document on that same iframe. In FF this works properly. However, in chrome code from the initial document.write persists even after I overwrite it with a second…
asutherland
  • 2,849
  • 4
  • 32
  • 50
4
votes
3 answers

How do I add something to my html using javascript without erasing the whole page

I have a small calculator that I'm adding to my html. It has a few dropdowns to select stuff and when a person hits a submit button, I'd like to display a picture below the calculator in my html. I've tried using a javascript function with:…
DannyD
  • 2,732
  • 16
  • 51
  • 73
3
votes
3 answers

How to load multiple CSS files within a JS script

Below I have a nested if statement which loads a certain CSS file depending on a users device. I also have a style sheet switcher which needs the CSS files to be loaded if a certain device is being used. if(navigator.userAgent.match(/Windows…
John Vasiliou
  • 977
  • 7
  • 27
  • 48
3
votes
2 answers

"error:ReferenceError: Security error: attempted to read protected variable: write" with Opera 11.5 and window.open and document.write

I am having an issue with window.open that only occurs with Opera (version 11.5). function openpageopera() { var w = window.open("","_blank"); try { w.document.write("

hello

world"); w.document.close(); } catch(err) { …
user717236
  • 4,959
  • 19
  • 66
  • 102
3
votes
0 answers

A parser-blocking, cross site (i.e. different eTLD+1) script invokes by https://ssl.google-analytics.com/ga.js invoked by document.w

I have a lot of warnings in my Chrome console about a cross-site script being invoked by a document.write. I'd like to get rid of this message but it is invoking by a js script downloaded via the google tag manager…
Henkjelt
  • 31
  • 2
3
votes
1 answer

Is it possible to change domparser element to string?

I have some HTML string. Use domparser to update some values, now i need back to HTML string format with updated values... Bcoz document.write accept only string. Checkout the Sample patch, const domName = 'MOBILE_NO'; // Below dom was getting from…
R.G.Krish
  • 487
  • 5
  • 22
3
votes
2 answers

Why does an entity escape at the end of the string not show up for document.write(x) on domready?

var target = '

\"\"<\/p>' $(function(){ var x=$('

').text(target).html(); alert(x); document.write(x) });
user7988893
3
votes
1 answer

Why can't observe document.write on document.body using MutationObserver API?

I failed to observe document.write on document.body. Here is code:
footer
Will render as
Ian Davis
  • 19,091
  • 30
  • 85
  • 133