<p><a href="https://github.com/openstreetmap/openstreetmap-website/blob/509f07b32e00174588081aca64b9ec1446948c8d/app/assets/javascripts/index/directions.js">index/directions.js</a> sets up all the endpoint marks and polyline when a <code>directions</code> request is made. So one way to getUrl of route can be that we can check if endpoint marks and ployline <a href="https://github.com/openstreetmap/openstreetmap-website/blob/447fef40cf9b213ec4c019cc84be5597c26edcb9/vendor/assets/leaflet/leaflet.js#L1719">exists in layer</a>.<br>
However. is that really necessary?  Why can't we use <code>window.location.href</code>  instead of <code>OSM.SERVER_URL</code> as starting point when preparing the share url? (Check <a href="https://github.com/openstreetmap/openstreetmap-website/blob/36cbda3c80beac9496316389d4f082383ed4322a/app/assets/javascripts/leaflet.map.js#L103">this line</a>)</p>

<p>If window url is used then sharing of things like <code>node</code> can will be make more sense. If you use <code>share</code> button you would get this link: <a href="http://www.openstreetmap.org/#map=10/23.4563/87.3029">http://www.openstreetmap.org/#map=10/23.4563/87.3029</a><br>
When window url makes more sense: <a href="http://www.openstreetmap.org/node/813334049#map=10/23.4563/87.3029">http://www.openstreetmap.org/node/813334049#map=10/23.4563/87.3029</a></p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/openstreetmap/openstreetmap-website/issues/905#issuecomment-158277561">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/ABWnLRW4S6RTp0uB8TGrns6EMkneOa-_ks5pHpwigaJpZM4Djy_E.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/openstreetmap/openstreetmap-website/issues/905#issuecomment-158277561"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>