<?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 Re: Access to XMLHttpRequest blocked by CORS policy in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/467170#M45370</link>
    <description>&lt;P&gt;I add an API with following script in let's say &lt;A href="https://besttigwelders.com/" target="_blank"&gt;https://besttigwelders.com/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script src="&lt;A href="http://apiendpoint.com/api/v1/api.js" target="_blank"&gt;http://apiendpoint.com/api/v1/api.js&lt;/A&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;div id="api" data-apikey="LA59CJI9HZ-KIJK4I5-3CKJC"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;api.js&lt;/P&gt;&lt;P&gt;$(function () {&lt;/P&gt;&lt;P&gt;apikey = $('#api').data('apikey');&lt;BR /&gt;$("#api").load("&lt;A href="http://apiendpoint.com?apikey=" target="_blank"&gt;http://apiendpoint.com?apikey=&lt;/A&gt;" + apikey);&lt;/P&gt;&lt;P&gt;})&lt;BR /&gt;When I load the page, I get following error:&lt;/P&gt;&lt;P&gt;XMLHttpRequest cannot load apiendpoint URL. Redirect from 'apiendpoint URL' to 'apiendpoint URL' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'test URL' is therefore not allowed access.&lt;/P&gt;&lt;P&gt;In the path of apiendpoint.com I added in .htaccess following code:&lt;/P&gt;&lt;P&gt;Header set Access-Control-Allow-Origin "*"&lt;/P&gt;</description>
    <pubDate>Tue, 27 Jul 2021 09:57:48 GMT</pubDate>
    <dc:creator>HVol</dc:creator>
    <dc:date>2021-07-27T09:57:48Z</dc:date>
    <item>
      <title>Access to XMLHttpRequest blocked by CORS policy</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/466853#M45353</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm currently in the process of making a custom form module that essentially takes the input from the form on submit, and sends an API POST request using the input that the user has submitted.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem is that I keep getting the following error :&lt;/P&gt;&lt;P&gt;'blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to know what the best solution to this problem could be? When I run the website on a chrome tab with disabled web security, it seems to work fine, but this doesn't seem like a robust long-term solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm quite new with web dev and API integration so any suggestions would be greatly appreciated, thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 21:02:39 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/466853#M45353</guid>
      <dc:creator>sdeveloper</dc:creator>
      <dc:date>2021-07-26T21:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Access to XMLHttpRequest blocked by CORS policy</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/467118#M45363</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/214157"&gt;@sdeveloper&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN data-sheets-value="{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;Because, HubSpot supported same domain with ajax request only or IP allowlisted on third party api if you can otherwise use serverless function for that.&amp;quot;}" data-sheets-userformat="{&amp;quot;2&amp;quot;:829,&amp;quot;3&amp;quot;:{&amp;quot;1&amp;quot;:0},&amp;quot;5&amp;quot;:{&amp;quot;1&amp;quot;:[{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0,&amp;quot;5&amp;quot;:{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0}},{&amp;quot;1&amp;quot;:0,&amp;quot;2&amp;quot;:0,&amp;quot;3&amp;quot;:3},{&amp;quot;1&amp;quot;:1,&amp;quot;2&amp;quot;:0,&amp;quot;4&amp;quot;:1}]},&amp;quot;6&amp;quot;:{&amp;quot;1&amp;quot;:[{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0,&amp;quot;5&amp;quot;:{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0}},{&amp;quot;1&amp;quot;:0,&amp;quot;2&amp;quot;:0,&amp;quot;3&amp;quot;:3},{&amp;quot;1&amp;quot;:1,&amp;quot;2&amp;quot;:0,&amp;quot;4&amp;quot;:1}]},&amp;quot;7&amp;quot;:{&amp;quot;1&amp;quot;:[{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0,&amp;quot;5&amp;quot;:{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0}},{&amp;quot;1&amp;quot;:0,&amp;quot;2&amp;quot;:0,&amp;quot;3&amp;quot;:3},{&amp;quot;1&amp;quot;:1,&amp;quot;2&amp;quot;:0,&amp;quot;4&amp;quot;:1}]},&amp;quot;8&amp;quot;:{&amp;quot;1&amp;quot;:[{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0,&amp;quot;5&amp;quot;:{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0}},{&amp;quot;1&amp;quot;:0,&amp;quot;2&amp;quot;:0,&amp;quot;3&amp;quot;:3},{&amp;quot;1&amp;quot;:1,&amp;quot;2&amp;quot;:0,&amp;quot;4&amp;quot;:1}]},&amp;quot;11&amp;quot;:4,&amp;quot;12&amp;quot;:0}"&gt;Because, HubSpot supports same domain with ajax request only or IP allowlisted on third party api if you can otherwise use serverless function for that.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P data-unlink="true"&gt;&lt;SPAN&gt;Hope this helps!&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;If we were able to answer your query, kindly help the community by marking it as a solution.&lt;BR /&gt;&lt;BR /&gt;Thanks and Regards.&lt;/SPAN&gt;&lt;SPAN data-sheets-value="{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:&amp;quot;Because, HubSpot supported same domain with ajax request only or IP allowlisted on third party api if you can otherwise use serverless function for that.&amp;quot;}" data-sheets-userformat="{&amp;quot;2&amp;quot;:829,&amp;quot;3&amp;quot;:{&amp;quot;1&amp;quot;:0},&amp;quot;5&amp;quot;:{&amp;quot;1&amp;quot;:[{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0,&amp;quot;5&amp;quot;:{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0}},{&amp;quot;1&amp;quot;:0,&amp;quot;2&amp;quot;:0,&amp;quot;3&amp;quot;:3},{&amp;quot;1&amp;quot;:1,&amp;quot;2&amp;quot;:0,&amp;quot;4&amp;quot;:1}]},&amp;quot;6&amp;quot;:{&amp;quot;1&amp;quot;:[{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0,&amp;quot;5&amp;quot;:{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0}},{&amp;quot;1&amp;quot;:0,&amp;quot;2&amp;quot;:0,&amp;quot;3&amp;quot;:3},{&amp;quot;1&amp;quot;:1,&amp;quot;2&amp;quot;:0,&amp;quot;4&amp;quot;:1}]},&amp;quot;7&amp;quot;:{&amp;quot;1&amp;quot;:[{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0,&amp;quot;5&amp;quot;:{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0}},{&amp;quot;1&amp;quot;:0,&amp;quot;2&amp;quot;:0,&amp;quot;3&amp;quot;:3},{&amp;quot;1&amp;quot;:1,&amp;quot;2&amp;quot;:0,&amp;quot;4&amp;quot;:1}]},&amp;quot;8&amp;quot;:{&amp;quot;1&amp;quot;:[{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0,&amp;quot;5&amp;quot;:{&amp;quot;1&amp;quot;:2,&amp;quot;2&amp;quot;:0}},{&amp;quot;1&amp;quot;:0,&amp;quot;2&amp;quot;:0,&amp;quot;3&amp;quot;:3},{&amp;quot;1&amp;quot;:1,&amp;quot;2&amp;quot;:0,&amp;quot;4&amp;quot;:1}]},&amp;quot;11&amp;quot;:4,&amp;quot;12&amp;quot;:0}"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 08:29:29 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/467118#M45363</guid>
      <dc:creator>webdew</dc:creator>
      <dc:date>2021-07-27T08:29:29Z</dc:date>
    </item>
    <item>
      <title>Re: Access to XMLHttpRequest blocked by CORS policy</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/467170#M45370</link>
      <description>&lt;P&gt;I add an API with following script in let's say &lt;A href="https://besttigwelders.com/" target="_blank"&gt;https://besttigwelders.com/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script src="&lt;A href="http://apiendpoint.com/api/v1/api.js" target="_blank"&gt;http://apiendpoint.com/api/v1/api.js&lt;/A&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;div id="api" data-apikey="LA59CJI9HZ-KIJK4I5-3CKJC"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;api.js&lt;/P&gt;&lt;P&gt;$(function () {&lt;/P&gt;&lt;P&gt;apikey = $('#api').data('apikey');&lt;BR /&gt;$("#api").load("&lt;A href="http://apiendpoint.com?apikey=" target="_blank"&gt;http://apiendpoint.com?apikey=&lt;/A&gt;" + apikey);&lt;/P&gt;&lt;P&gt;})&lt;BR /&gt;When I load the page, I get following error:&lt;/P&gt;&lt;P&gt;XMLHttpRequest cannot load apiendpoint URL. Redirect from 'apiendpoint URL' to 'apiendpoint URL' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'test URL' is therefore not allowed access.&lt;/P&gt;&lt;P&gt;In the path of apiendpoint.com I added in .htaccess following code:&lt;/P&gt;&lt;P&gt;Header set Access-Control-Allow-Origin "*"&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 09:57:48 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/467170#M45370</guid>
      <dc:creator>HVol</dc:creator>
      <dc:date>2021-07-27T09:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: Access to XMLHttpRequest blocked by CORS policy</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/467205#M45373</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/214157"&gt;@sdeveloper&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try by adding the domain in &lt;STRONG&gt;Settings &amp;gt; Tracking &amp;amp; Analytics &amp;gt; Tracking code &amp;gt; Advanced tracking tab&lt;/STRONG&gt; then add your domain in &lt;STRONG&gt;Additional site domains&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This post explains about CORS for your reference - &lt;A href="https://stackoverflow.com/questions/20035101/why-does-my-javascript-code-receive-a-no-access-control-allow-origin-header-i" target="_blank"&gt;https://stackoverflow.com/questions/20035101/why-does-my-javascript-code-receive-a-no-access-control-allow-origin-header-i&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 10:54:30 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/467205#M45373</guid>
      <dc:creator>himanshurauthan</dc:creator>
      <dc:date>2021-07-27T10:54:30Z</dc:date>
    </item>
    <item>
      <title>Re: Access to XMLHttpRequest blocked by CORS policy</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/467503#M45389</link>
      <description>&lt;P&gt;Thanks for the response.&lt;/P&gt;&lt;P&gt;The domain already seems to be in the additional site domain, so it doesn't let me add the specific site..&lt;/P&gt;&lt;P&gt;Any other suggestions would be greatly appreciated.&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 16:39:28 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/467503#M45389</guid>
      <dc:creator>sdeveloper</dc:creator>
      <dc:date>2021-07-27T16:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Access to XMLHttpRequest blocked by CORS policy</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/467506#M45390</link>
      <description>&lt;P&gt;Thanks for the response.&lt;/P&gt;&lt;P&gt;Do you know how I would edit/add the htaccess code for the website/module?&lt;/P&gt;&lt;P&gt;The form module doesn't seem to have a .htaccess file (maybe I add one in the linked files section?), and the actual website using the form module I created using the HubSpot website page builder and I don't see a way to add/edit a .htaccess file in there as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 16:44:07 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/467506#M45390</guid>
      <dc:creator>sdeveloper</dc:creator>
      <dc:date>2021-07-27T16:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: Access to XMLHttpRequest blocked by CORS policy</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/602539#M51927</link>
      <description>&lt;P&gt;Here is 100% working solution - for post data into hubspot form via creating JS API request -&lt;/P&gt;&lt;P&gt;&amp;lt;script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;script&amp;gt;&lt;BR /&gt;const hubspot_form_id = '{{ module.form_field.form_id }}' ;&lt;BR /&gt;function submitForm() {&lt;BR /&gt;console.log("test script");&lt;BR /&gt;var hbFrameId = 'hs-form-iframe-0';&lt;BR /&gt;var hbFormId = 'hsForm_' + hubspot_form_id;&lt;BR /&gt;var btnClass = 'hs-button primary';&lt;/P&gt;&lt;P&gt;var myForm = document.getElementById('home-page-contact');&lt;BR /&gt;// var iframe = document.getElementById(hbFrameId);&lt;BR /&gt;var frm = document.getElementById(hbFormId);&lt;BR /&gt;for(var i=0; i&amp;lt;frm.elements.length; i++){&lt;BR /&gt;var hbField = frm.elements[i];&lt;BR /&gt;for(var j=0; j&amp;lt;myForm.elements.length; j++){&lt;BR /&gt;var myField = myForm.elements[j];&lt;BR /&gt;if(myField.name == ("hb-"+hbField.name)){&lt;BR /&gt;hbField.value = myField.value;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;var dataJson = $(frm).serializeArray();&lt;BR /&gt;var data = new FormData($(frm)[0]);&lt;BR /&gt;$(frm).submit();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;hbspt.forms.create({&lt;BR /&gt;portalId: "16252",&lt;BR /&gt;formId: hubspot_form_id,&lt;BR /&gt;onFormReady: function () {&lt;BR /&gt;document.getElementsByClassName('hbspt-form')[0].style.display = 'none';&lt;BR /&gt;},&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Contact Any API Integration Or For Hubspot realted Query Crowdvolley PVT LTD.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Saurabh Upadhyay&lt;/P&gt;</description>
      <pubDate>Mon, 28 Mar 2022 06:41:22 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/602539#M51927</guid>
      <dc:creator>SUpadhyay</dc:creator>
      <dc:date>2022-03-28T06:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: Access to XMLHttpRequest blocked by CORS policy</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/781323#M63117</link>
      <description>&lt;P&gt;Hi Supadhyay,&lt;/P&gt;&lt;P&gt;Thanks for sharing your solution. I tweakid it a little bit because the javascript didn't saw the iframe:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;function submitForm() {&lt;BR /&gt;console.log("test script");&lt;BR /&gt;var hbFrameId = 'hs-form-iframe-0';&lt;BR /&gt;var hbFormId = 'hsForm_' + hubspot_form_id;&lt;BR /&gt;var btnClass = 'hs-button primary';&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;var frm = [];&lt;BR /&gt;var myForm = document.getElementById(hbFrameId).contentWindow.document.getElementById(hbFormId);&lt;BR /&gt;var iframe = document.getElementById(hbFrameId);&lt;BR /&gt;var frm = document.getElementById(hbFrameId).contentWindow.document.getElementById(hbFormId);&lt;BR /&gt;console.log(frm);&lt;BR /&gt;console.log(frm.elements[0]);&lt;BR /&gt;frm.elements[0].value = "{{profile.email}}";&lt;BR /&gt;const elem = frm.elements.length;&lt;BR /&gt;console.log(frm.elements[0]);&lt;BR /&gt;for(var i=0; i &amp;lt; elem; i++){&lt;BR /&gt;var hbField = frm.elements[i];&lt;BR /&gt;for(var j=0; j &amp;lt; elem; j++){&lt;BR /&gt;var myField = myForm.elements[j];&lt;BR /&gt;if(myField.name == ("hb-"+hbField.name)){&lt;BR /&gt;hbField.value = myField.value;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;var dataJson = $(frm).serializeArray();&lt;BR /&gt;var data = new FormData($(frm)[0]);&lt;BR /&gt;$(frm).submit();&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Thu, 13 Apr 2023 10:08:55 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/781323#M63117</guid>
      <dc:creator>MWWesterterp</dc:creator>
      <dc:date>2023-04-13T10:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: Access to XMLHttpRequest blocked by CORS policy</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/986101#M74090</link>
      <description>&lt;P&gt;I am having the same error with this code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;!--&lt;BR /&gt;templateType: "section"&lt;BR /&gt;label: "Multi-row content"&lt;BR /&gt;isAvailableForNewContent: true&lt;BR /&gt;--&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;{% dnd_section %}&lt;/P&gt;&lt;P&gt;{% dnd_module path='@hubspot/rich_text' %}&lt;BR /&gt;{% module_attribute "html" %}&lt;BR /&gt;&amp;lt;div class="newsletter"&amp;gt;&lt;BR /&gt;&amp;lt;div class="container px-5 w-75"&amp;gt;&lt;BR /&gt;&amp;lt;div class="row py-5"&amp;gt;&lt;BR /&gt;&amp;lt;div class="col-12 col-md-6"&amp;gt;&lt;BR /&gt;&amp;lt;h3 class="fw-bold"&amp;gt;&lt;span class="lia-unicode-emoji" title=":love_letter:"&gt;💌&lt;/span&gt; Subscribe to my newsletter&amp;lt;/h3&amp;gt;&lt;BR /&gt;&amp;lt;h5 class="fs-6"&amp;gt;Subscribe to my newsletter, with thoughts on life, identity, making things and more.&amp;lt;/h5&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;div class="col-12 col-md-6 d-flex justify-content-md-end align-items-start"&amp;gt;&lt;BR /&gt;&amp;lt;form id="newsletter" class="w-100 w-md-auto"&amp;gt;&lt;BR /&gt;&amp;lt;input type="text" class="form-control mb-3 py-2" name="firstName" placeholder="First Name" required&amp;gt;&lt;BR /&gt;&amp;lt;input type="email" class="form-control mb-3 py-2" name="email" placeholder="Email address" required&amp;gt;&lt;BR /&gt;&amp;lt;button type="submit" class="btn btn-primary w-100 py-3"&amp;gt;Subscribe&amp;lt;/button&amp;gt;&lt;BR /&gt;&amp;lt;/form&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;script&amp;gt;&lt;/P&gt;&lt;P&gt;const url = '&lt;A href="http://144585255.hs-sites-eu1.com/" target="_blank"&gt;http://144585255.hs-sites-eu1.com/&lt;/A&gt;';&lt;BR /&gt;const apiKey = 'CiRldTEtMDg5YS1kYzI4LTRlNDktYjE1Ni01MWQ5N2IxODRhOGYQp-T4RBjYyNwfKhkABeaRgmYgcKaY6G_KnGDnM3HmvwmZv6eESgNldTE';&lt;/P&gt;&lt;P&gt;const form = document.getElementById('newsletter');&lt;/P&gt;&lt;P&gt;form.addEventListener('submit', handleSubmit);&lt;/P&gt;&lt;P&gt;async function handleSubmit(event) {&lt;/P&gt;&lt;P&gt;event.preventDefault();&lt;/P&gt;&lt;P&gt;const formData = new FormData(form);&lt;BR /&gt;const data = Object.fromEntries(formData);&lt;/P&gt;&lt;P&gt;try {&lt;/P&gt;&lt;P&gt;const response = await fetch(url, {&lt;BR /&gt;method: 'POST',&lt;BR /&gt;headers: {&lt;BR /&gt;'Content-Type': 'application/json',&lt;BR /&gt;'Authorization': `Bearer ${apiKey}`&lt;BR /&gt;},&lt;BR /&gt;body: JSON.stringify(data)&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;if(!response.ok) {&lt;BR /&gt;throw new Error('Request failed');&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;alert('Subscription successful!');&lt;BR /&gt;form.reset();&lt;/P&gt;&lt;P&gt;} catch (error) {&lt;BR /&gt;alert('Subscription failed. Please try again.');&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;lt;/script&amp;gt;&lt;BR /&gt;{% end_module_attribute %}&lt;BR /&gt;{% end_dnd_module %}&lt;BR /&gt;{% end_dnd_section %}&lt;BR /&gt;&lt;STRONG&gt;Access to fetch at '&lt;A href="https://144585255.hs-sites-eu1.com/" target="_blank"&gt;https://144585255.hs-sites-eu1.com/&lt;/A&gt;' from origin '&lt;A href="https://144585255.hubspotpreview-eu1.com" target="_blank"&gt;https://144585255.hubspotpreview-eu1.com&lt;/A&gt;' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jun 2024 14:42:14 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/Access-to-XMLHttpRequest-blocked-by-CORS-policy/m-p/986101#M74090</guid>
      <dc:creator>SChipangura</dc:creator>
      <dc:date>2024-06-03T14:42:14Z</dc:date>
    </item>
  </channel>
</rss>

