Opera将我的新网站显示为XML,我不能为我的生活找出原因。
这就是萤火虫所说的话
服务器 ASP.NET Development Server / 10.0.0.0
日期周一,2010年11月8日22:58:32 GMT
X-AspNet-Version 4.0.30319
X-AspNetMvc-Version 2.0
内容编码 gzip
缓存控制私人
内容类型 text / html;字符集= UTF-8
内容长度 1835年 连接关闭
这就是W3C所说的话
<html>
<html>
这是标记
<!DOCTYPE html>
<html>
<head>
<title>What's happening around you right now! - My App</title>
<meta content="no" http-equiv="imagetoolbar" />
<link rel="search" type="application/opensearchdescription+xml" title="My App" href="/assets/xml/opensearch.xml" />
<link rel="stylesheet" type="text/css" href="/MYREALLYCOOLAPP/Extras/siteMaster.Css/1" />
</head>
<body>
<div class="page">
<div id="header">
<div id="title">
<div id="urban-now-logo">
<a href="/MYREALLYCOOLAPP/" title="My App"><span>My App</span> </a>
</div>
</div>
<div id="logindisplay">
<span id="logindisplaywrapper"><a href="/MYREALLYCOOLAPP/users/login?go=/MYREALLYCOOLAPP">log in</a> | <a href="/MYREALLYCOOLAPP/modalwindow/selectregion"
title="Change Region" class="RegionWindow">Calgary</a> | <a href="/MYREALLYCOOLAPP/about">about</a> | <a href="/MYREALLYCOOLAPP/about/faq">faq</a>
<span style="padding-left: 20px;"></span>
<form action="/MYREALLYCOOLAPP/search" id="searchForm" method="get">
<input id="search-text" name="q" tabindex="1" type="text" maxlength="80" size="28" placeholder="search..." />
</form>
</span>
</div>
<div id="menucontainer">
<div class="floatleft">
<ul class="menu">
<li><a class="youarehere" href="/MYREALLYCOOLAPP/">Now</a></li>
<li><a href="/MYREALLYCOOLAPP/events/coming">Coming</a></li>
<li><a href="/MYREALLYCOOLAPP/events/hot">Hot</a></li>
<li><a href="/MYREALLYCOOLAPP/tags">Tags</a></li>
<li><a href="/MYREALLYCOOLAPP/users">Users</a></li>
</ul>
</div>
<div class="floatright">
<ul class="menu">
<li><a href="/MYREALLYCOOLAPP/events/addevent">Add Event</a></li>
</ul>
</div>
</div>
</div>
<div class="clear">
</div>
<div id="main">
<h2>What's Happening Within The Next 24 Hours!</h2>
<hr />
<div id="innermain">
<div class="twocolumn-left">
<div id='bingMap' class="largeMap">
<noscript>
<img src="http://developer.multimap.com/API/map/1.2/OA10091719904371779?zoomFactor=11&width=550&height=400&lat_1=51.18468&lon_1=-114.497999&lat_2=51.169858&lon_2=-114.32549&lat_3=51.083277&lon_3=-114.203964&lat_4=51.063097&lon_4=-114.092031&lat_5=50.939664&lon_5=-113.973568" />
</noscript>
</div>
</div>
<div class="twocolumn-right">
</div>
</div>
<div id="footer">
<ul id="footernavigation">
<li>© 2010 - <a href="/MYREALLYCOOLAPP/">My App</a> - All Rights Reserved</li>
<li><span class="colorgreen increasesize-140">■</span> <a href="/MYREALLYCOOLAPP/about">about</a> | <span class="colorgreen increasesize-140">
■</span> <a href="/MYREALLYCOOLAPP/about/faq">faq</a> | <span class="colorgreen increasesize-140">■</span> <a href="/MYREALLYCOOLAPP/about/advertise">
advertise</a> | <span class="colorgreen increasesize-140">■</span> <a href="/MYREALLYCOOLAPP/about/legal">legal</a></li>
</ul>
</div>
</div>
</div>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.3"></script>
<script type="text/javascript" src="/MYREALLYCOOLAPP/Extras/MYREALLYCOOLAPP.js/1"></script>
<script type="text/javascript">
var zoomLevel = 10
var json_object = [{ "lat": 51.063097, "lon": -114.092031, "title": "Jubilee Auditorium", "desc": "Some great concerts go down here"}];
</script>
<script type="text/javascript" src="/MYREALLYCOOLAPP/Extras/bingmaps.js/1"></script>
</body>
</html>
基本上,当我在Opera推出网站时,顶部说
此文档没有样式信息。
然后显示我的所有标记(如xml)。
答案 0 :(得分:1)
您的DOCTYPE不需要指定适当的DTD等吗?例如:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
和/或是否需要为<html>
元素指定命名空间?例如:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
答案 1 :(得分:1)
看起来您的服务器正在将文件作为text / html发送到Firefox,而将application / xhtml + xml发送到Opera。
Opera(10.63)有一个类似firebug的界面,您可以查看。右键单击页面以显示上下文菜单,选择“Inspect Element”。选择“网络”选项卡,然后展开相关的请求行。然后打开“标题”或“原始”,它将显示用于将页面发送到Opera的内容类型。
要允许Opera正确处理页面application / xhtml + xml,请添加
xmlns="http://www.w3.org/1999/xhtml"
作为LukeH所说的html
元素的属性。