ago 27, 2021 1:32 AM
Hi everyone,
I come here with one problem I saw few times on this forum but I didn't find any solutions which fit with my need.
First I explain the problem which is simple, I create a module with these two simple line of code I use inside a template and so on every pages then:
<div id="wcb" class="carbonbadge"></div>
<script src="https://unpkg.com/website-carbon-badges@1.1.3/b.min.js" defer></script>
That's not my code, it should do his job, get the page and return some value depend how I build the page.
Now I get the CORS policy problem :
"has been blocked by CORS policy: 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."
the different solution I saw where :
- use ajax form(in this case I even not sure it can be done like that, and we change a simple code to a complex ajax request to get a json if it has, get the value to finaly update myself the div)
- use a server side with your own code, same as above, change a simple request to a long home made developpment.
- Update the htaccess, on hubspot I'm even not sure it's possible, if it is I don't know where.
So at the end my point is if someone got a solution or an idea to keep the code as simple as now, so two line to call an external source and overpass that cors problem.
Maybe I use it not correctly, actually the code I show before, I used it by creating a module and put these two line on the html part of the module. I also call the module inside the partial footer to use it on every page. If it can give more detail about how I made it.
Thanks for the help you can provide and if you need more detail, i'm here.
Kind regards.
Solucionado! Ir para Solução.
set 6, 2021 3:16 PM
jan 20, 2022 4:46 PM - editado jan 20, 2022 4:47 PM
Hello support,
we have a nodejs/riot.js website running on javascript. We use JSON to add contacts to Hubspot but we keep getting the Cors error. Any ways to fix that from the code?
It's kind or urgent.
set 6, 2021 3:16 PM
set 7, 2021 1:25 AM
Haaa, exact,
that's me who appoligize to didn't see it.
Ok so I will check from their side so and thank you for your check and answer.
Kind regards.
set 3, 2021 4:59 AM