How to fix CORS Issue in Smart Chat?


This problem occurs when you host Smart Chat at one domain and using its code on website which is on other domain. To resolve this problem, follow below steps.

  • Open index.php file at Smart Chat root folder
  • After PHP tags in line number 2 just paste this code and you are done.
  • header("Access-Control-Allow-Origin: *"); (this will allow ajax requests from other domain)
  • In order to allow only few domain use this
  • header("Access-Control-Allow-Origin: http://www.domain.com");

For more information about CORS, read this article.https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

LEAVE A COMMENT