title: How to download a file behind a semi-broken javascript asp function with R
body: <p>I am trying to fix a <a href="https://github.com/ajdamico/asdfree/blob/master/World%20Values%20Survey/download%20all%20microdata.R" rel="noreferrer">download automation script</a> that I provide publicly so that anyone can easily download the world values survey with R.</p>
  
  <p>On this web page - <a href="http://www.worldvaluessurvey.org/WVSDocumentationWV4.jsp" rel="noreferrer">http://www.worldvaluessurvey.org/WVSDocumentationWV4.jsp</a> - the PDF link "WVS_2000_Questionnaire_Root" easily downloads in firefox and chrome.I cannot figure out how to automate the download with <code>httr</code> or <code>RCurl</code> or any other R package.  screenshot below of the chrome internet behavior. That PDF link needs to follow through to the ultimate source of <a href="http://www.worldvaluessurvey.org/wvsdc/DC00012/F00001316-WVS_2000_Questionnaire_Root.pdf" rel="noreferrer">http://www.worldvaluessurvey.org/wvsdc/DC00012/F00001316-WVS_2000_Questionnaire_Root.pdf</a> but if you click their directly, there's a connectivity error.  i am unclear if this is related to the request header <code>Upgrade-Insecure-Requests:1</code> or the response header status code <code>302</code></p>
  
  <p>Clicking around the new worldvaluessurvey.org website with chrome's inspect element windows open makes me think there were some hacky coding decisions made here, hence the title semi-broken :/</p>
  
  <p><a href="https://i.stack.imgur.com/6rJKc.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6rJKc.png" alt="enter image description here"></a></p>