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 6317915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:35:06+00:00 2026-05-24T15:35:06+00:00

Is there a way to switch a page in quirksmode to standards mode using

  • 0

Is there a way to switch a page in quirksmode to standards mode using Javascript?

For example, assuming I have the following page with html in it. I’ve tried the following.

<html><script src="js.js"></script></html>

and the following content in js.js

document.open();
document.write('<!doctype html><html></html>');
document.close();

From looking at the output above I’m basically trying to convert a page in quirksmode to standards mode, but it doesn’t work. (setting the contents of a page like above on an iframe works fine)

iframe Works

It works you do document.createElement('iframe') append into the document and call iframe.contentWindow.document.write('<!doctype html>..'); on it. Unfortunately the same technique does not if I’m calling it on the current page.

Does anyone have a working fix switching a page in quirksmode to standards mode?

EDIT: Creating and appending an iframe and simply setting its height and width to 100%, works but isn’t the goal here 😉

  • 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-05-24T15:35:07+00:00Added an answer on May 24, 2026 at 3:35 pm

    The browser typically looks for a doctype at load time to determine whether to use “standards mode” or not, and loads/renders the page based on that decision. Even if you managed to insert a doctype declaration via script, it wouldn’t be there in time to matter.

    The reason it works in an iframe is that the content is a new document, which is being “loaded” as you write it. Since the doctype is there, that content is rendered in standards mode.

    As mentioned in another question on this same topic, you might be able to get away with rewriting the whole document. Basically, (if the page is still in quirks mode,) get document.documentElement.innerHTML, and then write a new document with the proper doctype, and append the HTML from the original document. But it will cause a bunch of issues with scripts and such, and should be avoided. The ideal solution is to fix the HTML to include a doctype, rather than fudging it with a script.

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

Sidebar

Related Questions

Is there a CTRL+space -like way of auto-constructing a switch case around a given
is there way thats i can preselect an item when the page loads or
Is there way to set @include mixin(); to variable? I tried this @mixin bg-gradient($fallback,
Is there way that I can read the file from remote server using fopen
For example, if i have on the aspx page: <asp:PlaceHolder ID=tab_0 runat=server Visible=false></asp:PlaceHolder> <asp:PlaceHolder
I am interested in using a page control to switch through entries in my
Is there a way to use JavaScript inside a LESS CSS file..? What I
Is there a way to add a new custom Display Mode to the WPF
I have an input in an HTML page <input id=SearchBox type=text value= width=300px title=Search
In Eclipse, I can switch through open editors using control-page up/down. This works great,

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.