0
I developed a chat, to implement it is necessary to add on the page of the client a . js (So the client does not have the job of creating the markup on his site, just import the js and ready, like any jquery plugin), it works basically like this, there is an html page where he searches the markup(html) and plays inside the client page body, I did it as follows:
This is an example(The original code is larger, but this excerpt summarizes the problem)
var ffchat = ffchat || (function () {
return {
addChat: function (Args) {
$(function () {
$.get('http://meuhost.com/chat/partial_chat.html', function (data) {
var html = $(data);
$("body").append(html);
});
});
}
};
}());
It worked perfectly in my local tests(Same host), the problem is that the browser blocks this request when it is for another host, it prevents me to get the html on my server.
How can I fetch an html file from my server and embed it into a client page?
Remembering that this file has css, js and html to customize the chat on the client page, the chat is in an iframe within this file.
Tried to release CORS on your server ?
– Maurício Júnior
But is this release done on the client machine or on my server? Because if it is on the client machine it does not solve my problem.
– Wictor Chaves
The release is made on your server. In case your server should say that other sites can send requests to it. In what language your server was made ?
– Maurício Júnior
created an htacess and put Header Set Access-Control-Allow-Origin "*" , but it didn’t help.
– Wictor Chaves
After putting this rule, I can’t even access js anymore, I did a quick search on Cors, if you want to post some answers using Cors
– Wictor Chaves
I’m not sure that’s the problem. And the release of Cors is not standardized for the servers, you would need to know which language you used to also do a survey and be able to answer you better.
– Maurício Júnior
basically I made a jquery plugin that imports an html, I’m using jquery, the chat is php, but it doesn’t matter since it is inside an iframe.
– Wictor Chaves
tried with $('body'). load("mypage_page.html"); ?
– Maurício Júnior
Yes, the effect is the same
– Wictor Chaves