Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8574637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:31:07+00:00 2026-06-11T19:31:07+00:00

I’ve seen a bit of chatter about document.write being deprecated, but I’m not sure

  • 0

I’ve seen a bit of chatter about document.write being deprecated, but I’m not sure exactly where this information came from. I did look it up in MDN, but there wasn’t any notation about it being deprecated.. so now I’m a bit suspicious. Google wasn’t much help either unfortunately (perhaps I just wasn’t using the right search terms).

If it is indeed deprecated, can someone link me to the appropriate documents showing that it is indeed deprecated?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:31:08+00:00Added an answer on June 11, 2026 at 7:31 pm

    No. It’s just most often considered bad practice and almost as misused as eval.

    Read: Why is document.write considered a ‘bad practice’?

    Quoting some important points from the linked question above:

    • document.write (henceforth DW) does not work in XHTML

    • DW executed after the page has finished loading will overwrite the page, or write a new page, or not work

    • DW executes where encountered: it cannot inject at a given node point

    Also as @JaredFarrish stated, deprecated is mostly a state of mind. It’s a relic that most likely will never go away otherwise it’d break many sites – even the Traditional Google Analytics code uses DW.

    Obviously, functionality-wise it has been superseded long ago by proper DOM manipulation methods, and quoting the linked question above again: DW is effectively writing serialised text which is not the way the DOM works conceptually.


    To counterbalance, here’s a list of where DW may be considered appropriate:

    • There’s nothing wrong with DW, per se – it won’t destroy your page if you use it appropriately;
    • It allows for easily fallbacking an external script to a local copy such as when loading jQuery from a CDN fails:

      <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
      <script>window.jQuery || document.write('<script src="js/libs/jquery-1.8.2.min.js">\x3C/script>');</script>
      
    • It’s one of the easiest ways to insert external snippets in your page while keeping the code short (e.g. analytics). Note that systems such as Google Analytics now favor the asynchronous method – creating a script element through the document.createElement API, setting its properties and appending it to the DOM – rather than using its traditional document.write method.

    tl;dr:
    DW is easily misused, hence for real world use, prefer a proper DOM manipulation method whenever viable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.