2
I’m trying to access another site of my.php program, but it’s returning the message:
Xmlhttprequest cannot load http://177.55.99.146:8080/Autenticacao/autentica? file=47d75bd903c790f2f48b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc2896c1e98b7dbbcc28. No 'Access-Control-Allow-Origin' header is present on the requested Resource. Origin 'http://www.yaratecnologia.com.br' is therefore not allowed access.
I changed the HTML code, but still keeps returning the same error. HTML code below:
<!DOCTYPE html>
<html>
<head>
<?php
header("Access-Control-Allow-Origin: *");
?>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<title>Projeto Yara Tecnologia</title>
<meta charset="UTF-16">
<style>html {
font-family: Helvetica, Arial, sans-serif;
font-size: 100%;
background: #333;
}
The inclusion of the command <?php header("Access-Control-Allow-Origin: *"); ?>
made no difference!!!
There is a correct place to write this command in HTML?
What am I doing wrong?
Didn’t make a difference? The way you posted, your code should have given error. This file you posted is actually being processed as a PHP file?
– user25930
In fact, I just posted the initial part of the code, not the whole code, because it’s too big. But it doesn’t give any error message. Only that message "is therefore not allowed access."
– Fernando
The headers have to be added in the file
http://177.55.99.146:8080/autenticacao/autentica
and not in that html of yours and that should be the answer that comes the closest to solving your problem: http://answall.com/a/12393/3635– Guilherme Nascimento