문제

My page is located here As you can see, it doesn't look like it's working properly. This becomes very apparent if you try to open it in an older browser (this is what initially set me off).

I checked the interpreted source code from chrome and it shows me the following:

<html>
    <head>
        <style type="text/css"></style>
    </head>
    <body>
            <title>Internet adgang - Hurtig opsætning - Ansatte</title>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8">

Etc..

Something seems to be closing my head tag which is causing all SORTS of errors:

W3 validator

I have absolutely no idea what is causing this.

You can see my source code here (I've scrambled the PHP):

The code above does not contain my body code, as I am fairly sure that has nothing to do with the head tag closing all of a sudden.

Here is some source of a page that works just fine:

I am completely baffled by this and I have no idea what to do nor what is causing it. Any ideas?

Solution

With the help of Buttc4k3 and vogomatix I finally found the solution. As buttc4k3 said, there was an illegal "zero-width no-space" character hidden in the file which didn't show in my sublime text editor. It would only show if you opened the file in Notepad++. I could not understand why this character would appear in google chrome, and not in my source, but after googling it, I found that a file saved in UTF-8 WITH BOM (Byte Order Marking) would save the BOM as a zero-width no-space character! This was where vogomatix saved me and told me that my file was saved with BOM and after recoding it without BOM it works fine.

So - if you have the same problem as me - save your file WITHOUT BOM ENCODING (this can be done in notepad++).

도움이 되었습니까?

해결책

I took the page source of your website and pasted it in Notepad++ and found a zero-width no-break space in line 3 column 5. It renders invisible in most editors/viewers, but it breaks the HTML parser of the browser. I don't know how or why it got there since I can't find it in the PHP code, but maybe you can find it by opening your code in Notepad++. It renders this character as a tiny dot. If you can't find it, delete everything from and including <head> to <title> and re-type it.

I hope this works.

PS: Even though it is not the reason why your page is broken, you should add <html> and </html> to the markup. Most browsers can deal with its absence, but it is there for a reason.

다른 팁

It seems like you are missing the <html> tag.

Current HTML-Code:

<!DOCTYPE html>
<head>
    <title>Internet adgang - Hurtig opsætning - Ansatte</title>

Must be something like that:

<!DOCTYPE html>
<html>
    <head>
        <title>Internet adgang - Hurtig opsætning - Ansatte</title>
        [...]
    </head>
    <body>
        [...]
    </body>
</html>

Edit the first part of your site to be as follows:

    <?php
   include 'XXXXX';
   include 'XXXXX';
   if(!isset($_GET['lang'])) {
       $lang = "DA";
   } else {
       $lang = $_GET['lang'];
   }
   ?>
<!DOCTYPE html>
<html lang="<?php $lang; ?>">
<head>
    <title><?php echo trans("Internet adgang - Hurtig opsætning - Ansatte", $lang); ?></title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <link rel="stylesheet" href="resources/styles/style.css" media="all">
    <script src="resources/js/jquery.min.js" type="text/javascript"></script>
    <script src="resources/js/jquery-ui.min.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="resources/styles/au-flowbox-style.css">
    <script type="text/javascript" src="resources/js/au-flowbox.js"></script>
    <script type="text/javascript" src="resources/js/au-flowbox.data.js"></script>
</head>
<body>
....
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top