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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:43:55+00:00 2026-06-03T15:43:55+00:00

I have written an application in Code Igniter. Unless i declare the <!DOCTYPE HTML>

  • 0

I have written an application in Code Igniter.

Unless i declare the <!DOCTYPE HTML> at the very beginning of index.php (the file in the root directory supplied by Code Igniter), Interenet Explorer forces itself into quirks mode and totally messes up my page. I have tried putting at the very beginning of my views with no luck.

This wouldn’t normally be a problem, but one of the controllers powers a mobile authentication system that returns a JSON response in the view and the <!DOCTYPE HTML> hinders the response.

So why is the doc type declaration being ignored when placed at the top of my views? and why does it work when placed at the top of index.php?

More importantly, how can I get around this?

Thanks for any help!

EDIT:

This is an example of a controller method that loads the view:

public function login()
    {
        ?><script type="text/javascript">console.log("Admin log in panel loaded");</script><?php

        //This method will have the credentials validation
        $this->load->library('form_validation');
        $this->form_validation->set_rules('email', 'Email', 'trim|required|xss_clean');
        $this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean|callback_checkDatabase');//Database gets queried with a call-back here.

        //Set custom validation messages:
        $this->form_validation->set_message('checkDatabase', 'Invalid credentials');

        //This is executed when the form is submitted
        if($this->form_validation->run() == FALSE)
        {
            //Field validation failed. User remains on login page.
            $this->load->view('header');
            $this->load->view('useradminviews/login');
            $this->load->view('footer');

        } else {
            //Login successful, redirect to admin dashboard
            ?><script type="text/javascript">console.log("User logged in successfully");</script><?php
            redirect('useradmin?login', 'refresh');
        }
    }

and this is header.php:

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>COFRA</title>
<link rel="icon" type="image/png" href="<?php echo base_url();?>/images/favicon.png" />
<script type="text/javascript" src="<?php echo base_url();?>/javascript/jquery.js"></script>

<?php

//Load different CSS for IE users:
if ($this->agent->is_browser('Internet Explorer'))
{
    ?>
        <link href="<?php echo base_url();?>/javascript/placeholder/css/style.css" rel="stylesheet" type="text/css" media="screen"/>
        <link href="<?php echo base_url();?>/css/COFRAIE.css" rel="stylesheet" type="text/css" media="screen"/>
        <script type="text/javascript" src="<?php echo base_url();?>/javascript/placeholder/js/jquery.placeholder.js"></script>
    <?php

} else {
    ?><link href="<?php echo base_url();?>/css/COFRA.css" rel="stylesheet" type="text/css" media="screen"/><?php
}
?>


</head>
  • 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-03T15:43:58+00:00Added an answer on June 3, 2026 at 3:43 pm

    Remove the JavaScript prints to the console. They should not run before the view.

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

Sidebar

Related Questions

I have written a application that parses the html code of some web pages.
I have written some code for playing a .wav through my application. Now I
I have an application written in C# that invokes some C code as well.
I have this code in my ASP.NET application written in C# that is trying
In our application, I have seen code written like this: User.java (User entity) public
I have an application with most of the code written in javascript. I am
I have written a code for mail application like: { MFMailComposeViewController *picker=[MFMailComposeViewController alloc] init];
I have sample code written for parsing xml file using javax.xml package. it uses
I have written a PHP application that broadcasts a voice message to phone numbers
I have a large application written using .Net remoting for file transfer. This was

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.