<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>MujuuLog &#187; Mobile</title>
	<atom:link href="http://mujuu.org/weblog/cat/web_memo/mobile/feed" rel="self" type="application/rss+xml" />
	<link>http://mujuu.org/weblog</link>
	<description>Web・自転車・写真など適当なメモ書き的なブログサイトです。</description>
	<lastBuildDate>Mon, 05 Dec 2011 14:45:08 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://mujuu.org/weblog/cat/web_memo/mobile/feed" />
		<item>
		<title>携帯サイト制作のメモ。</title>
		<link>http://mujuu.org/weblog/web_memo/221</link>
		<comments>http://mujuu.org/weblog/web_memo/221#comments</comments>
		<pubDate>Wed, 29 Jul 2009 13:12:04 +0000</pubDate>
		<dc:creator>shin2</dc:creator>
				<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Webメモ書き]]></category>

		<guid isPermaLink="false">http://www.mujuu.org/weblog/?p=221</guid>
		<description><![CDATA[携帯サイトを制作したい時のメモ。個人的には比較的新しい機種に絞ったとしても、3キャリア共通で1つのファイルですませたい。共通で作るには、CHTMLベースに各キャリアの共通部分のみのhtmlを使って簡単に書くこともできるが [...]]]></description>
			<content:encoded><![CDATA[<p>
携帯サイトを制作したい時のメモ。個人的には比較的新しい機種に絞ったとしても、3キャリア共通で1つのファイルですませたい。<br />共通で作るには、CHTMLベースに各キャリアの共通部分のみのhtmlを使って簡単に書くこともできるが、最近じゃXHTML + CSSにするのが良いみたいだ。<br />CSSはauとSoftBankは外部cssに対応しているけど&#8230;Docomoが非対応なのでインラインで書くことになる。（Docomoも2009年5月モデルからは対応してるとか&#8230;）
</p>
<p><span id="more-221"></span></p>
<p><strong>1．XML宣言</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;?xml version=&quot;1.0&quot; encoding=&quot;Shift_JIS&quot; ?&gt;</pre></div></div>

<p><strong>2．DOCTYPE宣言</strong></p>
<p>■Docomo 推奨</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//i-mode group (ja)//DTD XHTML i-XHTML(Locale/Ver.=ja/2.0) 1.0//EN&quot; &quot;i-xhtml_4ja_10.dtd&quot;&gt;</pre></div></div>

<p>■au 推奨 </p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//OPENWAVE//DTD XHTML 1.0//EN&quot; &quot;http://www.openwave.com/DTD/xhtml-basic.dtd&quot;&gt;</pre></div></div>

<p>■SoftBank 推奨 </p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//J-PHONE//DTD xhtml Basic 1.0Plus//EN&quot; &quot;xhtml-basic10-plus.dtd&quot;&gt;</pre></div></div>

<p>■W3C勧告 XHTML Basic<br />cssは外部スタイルシートのみに限定しているみたい。Docomoでアウトだ。</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C/DTD XHTML Basic 1.0//EN&quot; &quot;http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd&quot;&gt;</pre></div></div>

<p>■XHTML 1.0 Transitional<br />PCで使うタイプ。これでいけるっぽい？</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</pre></div></div>

<p>■XHTML Mobile Profile 1.0<br />とりあえずこれがベスト？</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;!DOCTYPE html PUBLIC &quot;-//WAPFORUM//DTD XHTML Mobile 1.0//EN&quot; &quot;http://www.wapforum.org/DTD/xhtml-mobile10.dtd&quot;&gt;</pre></div></div>

<p>
色々書き方があるけど、3キャリア共通で考えると「XHTML 1.0 Transitional」か「XHTML Mobile Profile 1.0」になるっぽい。<br />
「XHTML Basic」に「XHTML Mobile Profile 1.0」を統合した「XHTML Basic1.1」というのもあるみたいだけど、現時点ではまだまだ。今後各キャリアの対応に期待らしい。
</p>
<p><strong>3．MIMEタイプ</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;application/xhtml+xml; charset=Shift_JIS&quot; /&gt;</pre></div></div>

<p>
ただ、これだとauやSoftBankの機種では比較的新しいモノしか対応していないみたいだ。「application/xhtml+xml」が必須なのは、DocomoのFOMAなので、その辺り気を使いたい場合には、phpでキャリアを判定してDocomoでは「application/xhtml+xml」それ以外のau・SoftBankでは「text/html」を返すようにする。
</p>
<p>■.htaccessの設定<br />「ウェブサーバ側でHTTPヘッダの出力」をするために以下を記述。<br />これはDocomoのiモードでXHTMLを表示させるために必要。</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">AddType</span> application/xhtml+xml .html</pre></div></div>

<p>
iモードはDOCTYPE宣言が正しく行われていること。MIMEタイプが「application/xhtml+xml」であること。そして「ウェブサーバ側でHTTPヘッダの出力」がされないとXHTMLとしてを表示しない。
</p>
<p>phpを使って判定とかする場合は.htaccessは以下を記述。</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">AddType</span> application/x-httpd-php .html //拡張子htmlでphpを動くように</pre></div></div>

<p>htmlファイル内の1番先頭で以下をと記述。（動くかどうか未確認）</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: application/xhtml+xml&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;?xml version=&quot;1.0&quot; encoding=&quot;Shift_JIS&quot;?&gt;'</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>
htmlでphpを記述できるようになるなら、DOCTYPEとかもキャリアごと分ければいいような気もしてきた&#8230;。<br />
拡張子が.phpのままでよければ、.phpファイル内のheader()関数だけで、htaccessの設定はいらなそうだ。
</p>
<p>
phpを使うとかちょっと細かくなってきてしまったが、とりあえずこの辺を抑さえておけばOKかな。本格的に取りかかるときにshibaさんの<a href="http://dspt.blog59.fc2.com/" target="_blank">「携帯サイトを作ろう！　-ちょっと詳しいモバイルサイトの作り方-」</a>を参考にするか、「<a href="http://www.amazon.co.jp/gp/product/4797348488?ie=UTF8&#038;tag=dsptnet-22&#038;linkCode=as2&#038;camp=247&#038;creative=7399&#038;creativeASIN=4797348488" target="_blank">携帯サイト コーディング&#038;デザイン</a>」を買うかしよう&#8230;。
</p>
<p>【参考にしたサイト】</p>
<ul>
<li><a href="http://dspt.blog59.fc2.com/" target="_blank">携帯サイトを作ろう！　-ちょっと詳しいモバイルサイトの作り方-</a></li>
<li><a href="http://allabout.co.jp/internet/hpcreate/closeup/CU20090602A/" target="_blank">ALL ABOUT　携帯サイトの作り方-</a></li>
</ul>
<p>
ちょっと気になることは、phpを使うときはファイルの文字コードはShift_JISなのか？</p>
]]></content:encoded>
			<wfw:commentRss>http://mujuu.org/weblog/web_memo/221/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://mujuu.org/weblog/web_memo/221" />
	</item>
	</channel>
</rss>

