Security policy Browsers Servers

Asked

Viewed 38 times

1

Hi, about the CORS, I got a good look in this link, here from SOPT, But when I was testing, in practice, I found something interesting. Using the code below in a project with XAMPP and Notepad++, I have the impediment of access to the page/file [meuPHP.php], however, using Cordova in Visual Studio, which creates its own emulator, it accesses that file php and gets the return AJAX. Why is that? In the Cordova project I don’t put anything on header("Access-Control-Allow-Origin: *");. There’s nothing about that headline. Whereas, if I put such a header in the test file of Notepad++, with XAMPP server and tals, it accesses, but, I repeat, Cordova, in Visual Studio does not have this header and accesses it anyway. What explains this?

        $.ajax({
        type: "POST",
        url: "https://www.meuProjeto.com/meuPHP.php",
        async: true,
        dataType: "json",
        success: function (dados) {
            for (var i = 0; dados.length > i; i++) {
                $('body').append('<p>'+dados[i].id);
            }
            }
        });

Continuing... need to know this situation for safety.

  • I don’t know if this is the case, but CORS only applies to requests made by the browser

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.