4

メールに内部リンクを挿入するにはどうすればよいですか?

ブラウザで開いた html を次に示します。gmail でコピーして貼り付け、自分に送信し、内部リンクが機能していることを期待します。

<html>
  <body>
    <p><a href="#Title1" title="Click to go to Title 1">Birds</a></p>
    <p><a href="#Title2" title="Click to go to Title 2">Trees</a></p>
    <p><a href="#Title3" title="Click to go to Title 3">Flowers</a></p>
    <h4 id="Title1">Birds</h4>
    <p> There are many different birds. There are... </p>
    <h4 id="Title2">Trees</h4>
    <p> Trees have many different colors and branches... </p>
    <h4 id="Title3">Flowers</h4>
    <p> The Lignum Vitae is the national flower of Jamaica... </p>
  </body>
</html>

編集

私は自分自身に次のように送っています:

<html>
  <body>
    <p><a href="#Title1" title="Click to go to Title 1">Birds</a></p>
    <p><a href="#Title2" title="Click to go to Title 2">Trees</a></p>
    <p><a href="#Title3" title="Click to go to Title 3">Flowers</a></p>
    <h4 id="Title1"><a name="Title1">Birds</a></h4>
    <p> There are many different birds. There are... HOWEVER, it should be noted that Gmail appears to override the default browser/HTML functionality with JavaScript (and inserts a prefix into the named anchor and corresponding href so as not to interfere with its web interface). Consequently it seems that Gmail will only scroll to the named anchor if it is currently out of view - if it is already visible then no scroll occurs. HOWEVER, it should be noted that Gmail appears to override the default browser/HTML functionality with JavaScript (and inserts a prefix into the named anchor and corresponding href so as not to interfere with its web interface). Consequently it seems that Gmail will only scroll to the named anchor if it is currently out of view - if it is already visible then no scroll occurs.</p>
    <h4 id="Title2"><a name="Title2">Trees</a></h4>
    <p> Trees have many different colors and branches... HOWEVER, it should be noted that Gmail appears to override the default browser/HTML functionality with JavaScript (and inserts a prefix into the named anchor and corresponding href so as not to interfere with its web interface). Consequently it seems that Gmail will only scroll to the named anchor if it is currently out of view - if it is already visible then no scroll occurs. HOWEVER, it should be noted that Gmail appears to override the default browser/HTML functionality with JavaScript (and inserts a prefix into the named anchor and corresponding href so as not to interfere with its web interface). Consequently it seems that Gmail will only scroll to the named anchor if it is currently out of view - if it is already visible then no scroll occurs.</p>
    <h4 id="Title3"><a name="Title3">Flowers</a></h4>
    <p> The Lignum Vitae is the national flower of Jamaica... HOWEVER, it should be noted that Gmail appears to override the default browser/HTML functionality with JavaScript (and inserts a prefix into the named anchor and corresponding href so as not to interfere with its web interface). Consequently it seems that Gmail will only scroll to the named anchor if it is currently out of view - if it is already visible then no scroll occurs. HOWEVER, it should be noted that Gmail appears to override the default browser/HTML functionality with JavaScript (and inserts a prefix into the named anchor and corresponding href so as not to interfere with its web interface). Consequently it seems that Gmail will only scroll to the named anchor if it is currently out of view - if it is already visible then no scroll occurs.</p>
  </body>
</html>

リンクはクリックできません。私は何を間違っていますか?

4

1 に答える 1

7

Gmailでは、名前付きアンカーを使用する必要があります。

<a name="Title1">Birds</a>

ご想像のとおり、メール クライアントが異なれば、動作も異なります。ID への内部リンクをサポートするものもあります。そうでない人もいます。両方をサポートするものもあります。私の知る限り、gmail は名前付きアンカーのみをサポートしています。内部リンクをまったくサポートしない電子メール クライアントが存在する可能性があることに注意してください。

名前付きアンカーはほとんどの電子メール クライアントで機能するはずなのでidh4は厳密には必要ありません。ただし、私が知る限り、両方を持たない理由はありません。以下はGmailで機能します:

<h4 id="Title1"><a name="Title1">Birds</a></h4>

ただし、Gmail はデフォルトのブラウザー/HTML 機能を JavaScript でオーバーライドしているように見えることに注意してください (そして、Web インターフェースに干渉しないように、名前付きアンカーと対応する href にプレフィックスを挿入します)。その結果、Gmail は名前付きアンカーが現在表示されていない場合にのみスクロールするようです。アンカーが既に表示されている場合、スクロールは行われません。

于 2013-04-24T07:41:45.363 に答える