<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>madogiwa0124</author_name>
  <author_url>https://blog.hatena.ne.jp/madogiwa0124/</author_url>
  <blog_title>Madogiwa Blog</blog_title>
  <blog_url>https://madogiwa0124.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby on Rails</anon>
    <anon>JavaScript</anon>
    <anon>開発</anon>
  </categories>
  <description>最近、下記のようなページの離脱時のイベントを補足してサーバーにリクエストを投げるような処理を実装したのですが、 import axios from axios; window.addEventListener('beforeunload', () =&gt; { axios.post('/logs', { event: 'beforeunload' }); }) ページの離脱にリクエストが送信されたり、されなかったり、ブラウザによって挙動が違っておりということがあり、そもそもMDNのドキュメントを見ると推奨されていないようでした😢 ユーザーエージェントは通常 unload ハンドラーの中で生成された…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmadogiwa0124.hatenablog.com%2Fentry%2F2019%2F10%2F19%2F225859&quot; title=&quot;ブラウザの離脱イベント時にリクエストを投げるときにはsendBeaconを使ったほうが良いという話 - Madogiwa Blog&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-10-19 22:58:59</published>
  <title>ブラウザの離脱イベント時にリクエストを投げるときにはsendBeaconを使ったほうが良いという話</title>
  <type>rich</type>
  <url>https://madogiwa0124.hatenablog.com/entry/2019/10/19/225859</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
