title: Current location path as a url parameter
body: <p>I need to put a link out from a corporate site to a surveymonkey survey. Our site uses a proprietary CMS limiting me from adding any proper function or third party plugin.</p>
  
  <p>After evaluating options like those exposed in <a href="https://stackoverflow.com/questions/406192/get-current-url-in-javascript">this other question</a>, I believe I call the correct javascript function but everytime I open my CMS, the link duplicates itself... leading me to think I've done something inapropriate.</p>
  
  <p>Things look acceptable on <a href="https://jsfiddle.net/n770u0LL/1/" rel="nofollow noreferrer">the JSFiddle demo</a> I put together for this question but I'm hoping you'd have a more elegant solution in mind so I could try options !</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  document.write("&lt;a href='https://www.surveymonkey.com/r/[SURVEYID]?url=" + window.location.pathname + " target='_blank'&gt;Test - survey&lt;/a&gt;");
  &lt;/script&gt;
  </code></pre>