CMS Development

joan1
Contributor

Blocked by CORS Policy

SOLVE

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.

0 Upvotes
1 Accepted solution
Teun
Solution
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Blocked by CORS Policy

SOLVE
Sorry for the late response.
I checked their Gitlab Repo and it seems that the issue is not with HubSpot but with Website Carbon Badge as multiple people are reporting the same issue you are having: https://gitlab.com/wholegrain/website-carbon-badges/-/issues/20


Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


View solution in original post

4 Replies 4
CBourassa
Member

Blocked by CORS Policy

SOLVE

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.

0 Upvotes
Teun
Solution
Recognized Expert | Diamond Partner
Recognized Expert | Diamond Partner

Blocked by CORS Policy

SOLVE
Sorry for the late response.
I checked their Gitlab Repo and it seems that the issue is not with HubSpot but with Website Carbon Badge as multiple people are reporting the same issue you are having: https://gitlab.com/wholegrain/website-carbon-badges/-/issues/20


Learn more about HubSpot by following me on LinkedIn or YouTube

Did my answer solve your issue? Help the community by marking it as the solution.


joan1
Contributor

Blocked by CORS Policy

SOLVE

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.

natsumimori
Community Manager
Community Manager

Blocked by CORS Policy

SOLVE

Thank you for your post @joan1 .

 

Hi @stefen and @Teun , I'm wondering if you could weigh in here. Would you be able to share your advice?