<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic JSONP request lost its referer header in 3.31 in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/jsonp-request-lost-its-referer-header-in-3-31/m-p/1066740#M73448</link>
    <description>&lt;P&gt;when i add a layer to map, i found the JSONP request lost its referer header,this may cause some problems.&lt;/P&gt;&lt;P&gt;the referer header is useful in our project.&lt;/P&gt;&lt;P&gt;and i have debugged&amp;nbsp; the&amp;nbsp; lastest version(3.31) like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="佑刘_0-1623295397091.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/15591i0D277698FE85EC94/image-size/medium?v=v2&amp;amp;px=400" role="button" title="佑刘_0-1623295397091.png" alt="佑刘_0-1623295397091.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;so i have some test:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;html&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;script&amp;gt;
  var h =
    '\x3c!DOCTYPE html\x3e ' +
    '\x3chtml\x3e ' +
    '	\x3cmeta http-equiv="Content-Security-Policy" content="default-src \'none\'; script-src * \'unsafe-inline\'"\x3e ' +
    '\x3chead\x3e ' +
    '	\x3cscript\x3e ' +
    '		var url2 = \'https://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer\'; ' +
    '		var f = document.createElement("script"); ' +
    '		f.type = "text/javascript"; ' +
    '		f.src=url2; ' +
    '		f.async = !0; ' +
    '		f.charset = "utf-8"; ' +
    '		document.getElementsByTagName("head")[0].appendChild(f); ' +
    '	\x3c/script\x3e ' +
    '\x3c/head\x3e ' +
    '\x3cbody\x3e ' +
    '\x3c/body\x3e ' +
    '\x3c/html\x3e'
  var a = document.createElement("iframe");
  a.name = "esri_core_jsonp_iframe";
  a.style.display = "none";
  // referer has lost in request header if add this line
  a.setAttribute("sandbox", "allow-scripts");
  a.srcdoc = h
  document.body.appendChild(a);

  var a2 = document.createElement("iframe");
  a2.name = "esri_core_jsonp_iframe2";
  a2.style.display = "none";
  // i think this request header is nomal
  // a2.setAttribute("sandbox", "allow-scripts");
  a2.srcdoc = h
  document.body.appendChild(a2);
&amp;lt;/script&amp;gt;

&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this function can run normal if don't add the "sandbox" attribute ,so why do you add the "sandbox" attribute? please let me kown,thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 10 Jun 2021 03:30:08 GMT</pubDate>
    <dc:creator>佑刘</dc:creator>
    <dc:date>2021-06-10T03:30:08Z</dc:date>
    <item>
      <title>JSONP request lost its referer header in 3.31</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/jsonp-request-lost-its-referer-header-in-3-31/m-p/1066740#M73448</link>
      <description>&lt;P&gt;when i add a layer to map, i found the JSONP request lost its referer header,this may cause some problems.&lt;/P&gt;&lt;P&gt;the referer header is useful in our project.&lt;/P&gt;&lt;P&gt;and i have debugged&amp;nbsp; the&amp;nbsp; lastest version(3.31) like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="佑刘_0-1623295397091.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/15591i0D277698FE85EC94/image-size/medium?v=v2&amp;amp;px=400" role="button" title="佑刘_0-1623295397091.png" alt="佑刘_0-1623295397091.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;so i have some test:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;html&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;script&amp;gt;
  var h =
    '\x3c!DOCTYPE html\x3e ' +
    '\x3chtml\x3e ' +
    '	\x3cmeta http-equiv="Content-Security-Policy" content="default-src \'none\'; script-src * \'unsafe-inline\'"\x3e ' +
    '\x3chead\x3e ' +
    '	\x3cscript\x3e ' +
    '		var url2 = \'https://sampleserver6.arcgisonline.com/arcgis/rest/services/SampleWorldCities/MapServer\'; ' +
    '		var f = document.createElement("script"); ' +
    '		f.type = "text/javascript"; ' +
    '		f.src=url2; ' +
    '		f.async = !0; ' +
    '		f.charset = "utf-8"; ' +
    '		document.getElementsByTagName("head")[0].appendChild(f); ' +
    '	\x3c/script\x3e ' +
    '\x3c/head\x3e ' +
    '\x3cbody\x3e ' +
    '\x3c/body\x3e ' +
    '\x3c/html\x3e'
  var a = document.createElement("iframe");
  a.name = "esri_core_jsonp_iframe";
  a.style.display = "none";
  // referer has lost in request header if add this line
  a.setAttribute("sandbox", "allow-scripts");
  a.srcdoc = h
  document.body.appendChild(a);

  var a2 = document.createElement("iframe");
  a2.name = "esri_core_jsonp_iframe2";
  a2.style.display = "none";
  // i think this request header is nomal
  // a2.setAttribute("sandbox", "allow-scripts");
  a2.srcdoc = h
  document.body.appendChild(a2);
&amp;lt;/script&amp;gt;

&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this function can run normal if don't add the "sandbox" attribute ,so why do you add the "sandbox" attribute? please let me kown,thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jun 2021 03:30:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/jsonp-request-lost-its-referer-header-in-3-31/m-p/1066740#M73448</guid>
      <dc:creator>佑刘</dc:creator>
      <dc:date>2021-06-10T03:30:08Z</dc:date>
    </item>
  </channel>
</rss>

