CORS blocks jquery on Chrome












-1















So I got to do a website for my mediaproduction course.



The task is to enfold a section by clicking on a button. But everytime I click on the button I get some CORS errors in the browser console. The strange thing is, it only happens in Chrome. Firefox works fine.chrome console error










share|improve this question























  • You need to be running your page on a local server not from file:// protocol in order to use ajax. There are browser extension workarounds but setting up local server is very easy

    – charlietfl
    Nov 22 '18 at 21:05













  • Are you on a Mac?

    – Randy Casburn
    Nov 22 '18 at 21:08











  • Is the button doing request on local resources or external? As it works in some browsers, I would guess charlietfl solved the mystery already. In that case, I would suggest running a local lightweight server (e.g.: livereload.com) to really avoid any specific behavior while serving local files. If there are external requests, look at developer.mozilla.org/en-US/docs/Web/HTTP/CORS to understand the issue better.

    – GriffoGoes
    Nov 22 '18 at 21:36
















-1















So I got to do a website for my mediaproduction course.



The task is to enfold a section by clicking on a button. But everytime I click on the button I get some CORS errors in the browser console. The strange thing is, it only happens in Chrome. Firefox works fine.chrome console error










share|improve this question























  • You need to be running your page on a local server not from file:// protocol in order to use ajax. There are browser extension workarounds but setting up local server is very easy

    – charlietfl
    Nov 22 '18 at 21:05













  • Are you on a Mac?

    – Randy Casburn
    Nov 22 '18 at 21:08











  • Is the button doing request on local resources or external? As it works in some browsers, I would guess charlietfl solved the mystery already. In that case, I would suggest running a local lightweight server (e.g.: livereload.com) to really avoid any specific behavior while serving local files. If there are external requests, look at developer.mozilla.org/en-US/docs/Web/HTTP/CORS to understand the issue better.

    – GriffoGoes
    Nov 22 '18 at 21:36














-1












-1








-1


0






So I got to do a website for my mediaproduction course.



The task is to enfold a section by clicking on a button. But everytime I click on the button I get some CORS errors in the browser console. The strange thing is, it only happens in Chrome. Firefox works fine.chrome console error










share|improve this question














So I got to do a website for my mediaproduction course.



The task is to enfold a section by clicking on a button. But everytime I click on the button I get some CORS errors in the browser console. The strange thing is, it only happens in Chrome. Firefox works fine.chrome console error







javascript html google-chrome cors






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 '18 at 20:59









C0baC0ba

13




13













  • You need to be running your page on a local server not from file:// protocol in order to use ajax. There are browser extension workarounds but setting up local server is very easy

    – charlietfl
    Nov 22 '18 at 21:05













  • Are you on a Mac?

    – Randy Casburn
    Nov 22 '18 at 21:08











  • Is the button doing request on local resources or external? As it works in some browsers, I would guess charlietfl solved the mystery already. In that case, I would suggest running a local lightweight server (e.g.: livereload.com) to really avoid any specific behavior while serving local files. If there are external requests, look at developer.mozilla.org/en-US/docs/Web/HTTP/CORS to understand the issue better.

    – GriffoGoes
    Nov 22 '18 at 21:36



















  • You need to be running your page on a local server not from file:// protocol in order to use ajax. There are browser extension workarounds but setting up local server is very easy

    – charlietfl
    Nov 22 '18 at 21:05













  • Are you on a Mac?

    – Randy Casburn
    Nov 22 '18 at 21:08











  • Is the button doing request on local resources or external? As it works in some browsers, I would guess charlietfl solved the mystery already. In that case, I would suggest running a local lightweight server (e.g.: livereload.com) to really avoid any specific behavior while serving local files. If there are external requests, look at developer.mozilla.org/en-US/docs/Web/HTTP/CORS to understand the issue better.

    – GriffoGoes
    Nov 22 '18 at 21:36

















You need to be running your page on a local server not from file:// protocol in order to use ajax. There are browser extension workarounds but setting up local server is very easy

– charlietfl
Nov 22 '18 at 21:05







You need to be running your page on a local server not from file:// protocol in order to use ajax. There are browser extension workarounds but setting up local server is very easy

– charlietfl
Nov 22 '18 at 21:05















Are you on a Mac?

– Randy Casburn
Nov 22 '18 at 21:08





Are you on a Mac?

– Randy Casburn
Nov 22 '18 at 21:08













Is the button doing request on local resources or external? As it works in some browsers, I would guess charlietfl solved the mystery already. In that case, I would suggest running a local lightweight server (e.g.: livereload.com) to really avoid any specific behavior while serving local files. If there are external requests, look at developer.mozilla.org/en-US/docs/Web/HTTP/CORS to understand the issue better.

– GriffoGoes
Nov 22 '18 at 21:36





Is the button doing request on local resources or external? As it works in some browsers, I would guess charlietfl solved the mystery already. In that case, I would suggest running a local lightweight server (e.g.: livereload.com) to really avoid any specific behavior while serving local files. If there are external requests, look at developer.mozilla.org/en-US/docs/Web/HTTP/CORS to understand the issue better.

– GriffoGoes
Nov 22 '18 at 21:36












1 Answer
1






active

oldest

votes


















0














You can use like below quote for MacOS and Windows:




Chrome has a wonderful command line argument to disable web security. To start Chrome with web security disabled, run the following command:



/Applications/Google Chrome.app/Contents/MacOS/Google Chrome --disable-web-security



If you’re using Windows, navigate to the path of your installation via a command prompt and run the following:



Chrome.exe --disable-web-security




reference: https://www.thepolyglotdeveloper.com/2014/08/bypass-cors-errors-testing-apis-locally/






share|improve this answer



















  • 1





    hasnt fixed the errors

    – C0ba
    Nov 23 '18 at 2:30











  • Try to host file which has ajax in apache server on your machine so it can be opened with localhost/path to your html file inside htdocs or apache public folder which contains your file... I think it will solve your problem with chrome... Chrome 70 and above is too restricted even if we try to make a site with https on localhost

    – Poode
    Nov 23 '18 at 3:50











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53437916%2fcors-blocks-jquery-on-chrome%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You can use like below quote for MacOS and Windows:




Chrome has a wonderful command line argument to disable web security. To start Chrome with web security disabled, run the following command:



/Applications/Google Chrome.app/Contents/MacOS/Google Chrome --disable-web-security



If you’re using Windows, navigate to the path of your installation via a command prompt and run the following:



Chrome.exe --disable-web-security




reference: https://www.thepolyglotdeveloper.com/2014/08/bypass-cors-errors-testing-apis-locally/






share|improve this answer



















  • 1





    hasnt fixed the errors

    – C0ba
    Nov 23 '18 at 2:30











  • Try to host file which has ajax in apache server on your machine so it can be opened with localhost/path to your html file inside htdocs or apache public folder which contains your file... I think it will solve your problem with chrome... Chrome 70 and above is too restricted even if we try to make a site with https on localhost

    – Poode
    Nov 23 '18 at 3:50
















0














You can use like below quote for MacOS and Windows:




Chrome has a wonderful command line argument to disable web security. To start Chrome with web security disabled, run the following command:



/Applications/Google Chrome.app/Contents/MacOS/Google Chrome --disable-web-security



If you’re using Windows, navigate to the path of your installation via a command prompt and run the following:



Chrome.exe --disable-web-security




reference: https://www.thepolyglotdeveloper.com/2014/08/bypass-cors-errors-testing-apis-locally/






share|improve this answer



















  • 1





    hasnt fixed the errors

    – C0ba
    Nov 23 '18 at 2:30











  • Try to host file which has ajax in apache server on your machine so it can be opened with localhost/path to your html file inside htdocs or apache public folder which contains your file... I think it will solve your problem with chrome... Chrome 70 and above is too restricted even if we try to make a site with https on localhost

    – Poode
    Nov 23 '18 at 3:50














0












0








0







You can use like below quote for MacOS and Windows:




Chrome has a wonderful command line argument to disable web security. To start Chrome with web security disabled, run the following command:



/Applications/Google Chrome.app/Contents/MacOS/Google Chrome --disable-web-security



If you’re using Windows, navigate to the path of your installation via a command prompt and run the following:



Chrome.exe --disable-web-security




reference: https://www.thepolyglotdeveloper.com/2014/08/bypass-cors-errors-testing-apis-locally/






share|improve this answer













You can use like below quote for MacOS and Windows:




Chrome has a wonderful command line argument to disable web security. To start Chrome with web security disabled, run the following command:



/Applications/Google Chrome.app/Contents/MacOS/Google Chrome --disable-web-security



If you’re using Windows, navigate to the path of your installation via a command prompt and run the following:



Chrome.exe --disable-web-security




reference: https://www.thepolyglotdeveloper.com/2014/08/bypass-cors-errors-testing-apis-locally/







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 '18 at 21:59









PoodePoode

37337




37337








  • 1





    hasnt fixed the errors

    – C0ba
    Nov 23 '18 at 2:30











  • Try to host file which has ajax in apache server on your machine so it can be opened with localhost/path to your html file inside htdocs or apache public folder which contains your file... I think it will solve your problem with chrome... Chrome 70 and above is too restricted even if we try to make a site with https on localhost

    – Poode
    Nov 23 '18 at 3:50














  • 1





    hasnt fixed the errors

    – C0ba
    Nov 23 '18 at 2:30











  • Try to host file which has ajax in apache server on your machine so it can be opened with localhost/path to your html file inside htdocs or apache public folder which contains your file... I think it will solve your problem with chrome... Chrome 70 and above is too restricted even if we try to make a site with https on localhost

    – Poode
    Nov 23 '18 at 3:50








1




1





hasnt fixed the errors

– C0ba
Nov 23 '18 at 2:30





hasnt fixed the errors

– C0ba
Nov 23 '18 at 2:30













Try to host file which has ajax in apache server on your machine so it can be opened with localhost/path to your html file inside htdocs or apache public folder which contains your file... I think it will solve your problem with chrome... Chrome 70 and above is too restricted even if we try to make a site with https on localhost

– Poode
Nov 23 '18 at 3:50





Try to host file which has ajax in apache server on your machine so it can be opened with localhost/path to your html file inside htdocs or apache public folder which contains your file... I think it will solve your problem with chrome... Chrome 70 and above is too restricted even if we try to make a site with https on localhost

– Poode
Nov 23 '18 at 3:50




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53437916%2fcors-blocks-jquery-on-chrome%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Paul Cézanne

UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

Angular material date-picker (MatDatepicker) auto completes the date on focus out