suddenly XMLHttpRequest Post problems in web extension

27 views
Skip to first unread message

grka...@googlemail.com

unread,
May 12, 2018, 11:50:26 AM5/12/18
to Chromium-Extensions-Announce
I hope someone can help me, since 2 days I have problems to send a JSON string to my php File.

In my web extension I have a json that must be sent to my php file:

var request = new XMLHttpRequest;
    request
.open("POST", "http://www.xxx.de/Add.php", true);
    request
.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
    request
.addEventListener('load', function (event) {
       
if (request.status >= 200 && request.status < 300) {
           
       
}
        console
.log("Sent status: " + request.status);
   
});


    request
.send(JSON.stringify(item));


with a console log I see that my item is not empty and the request.status is 200.

In my Add.php file I have

$data = file_get_contents('php://input');


$data is empty when I look at it. 3 days ago everything was running fine...

What could be wrong?

grka...@googlemail.com

unread,
May 12, 2018, 11:53:26 AM5/12/18
to Chromium-Extensions-Announce

I may mention that the only thing I changed was to force my webseite to forwards from http to https with a htaccess file. Could this be the reason?

puja...@gmail.com

unread,
May 12, 2018, 12:02:01 PM5/12/18
to chromium-...@chromium.org

Hello!

I use a new email filtering service called BitBounce to better filter my spam. To deliver your email to my inbox, please click the link below and pay the small Credo fee. Thank you!

You can sign up or get more info about BitBounce by clicking here.

To deliver your email:

We’ve never met. I’ll pay your fee.

I know you. Add me to your whitelist.

Email That Pays

BitBounce is powered
by the Credo cryptocurrency
and created by:

Turing Technology, Inc.

San Mateo, CA

puja...@gmail.com

unread,
May 12, 2018, 12:02:01 PM5/12/18
to chromium-...@chromium.org

gkiro...@gmail.com

unread,
May 12, 2018, 12:11:31 PM5/12/18
to chromium-...@chromium.org

gkiro...@gmail.com

unread,
May 12, 2018, 12:11:37 PM5/12/18
to chromium-...@chromium.org

PhistucK

unread,
May 12, 2018, 12:19:33 PM5/12/18
to grka...@googlemail.com, Chromium-extensions
I guess it is probably the reason. I am not sure POST data is also forwarded when you redirect. I think you have to use a certain HTTP status code that makes the browser forward the POST data as well, if such HTTP status code exists.

PhistucK


On Sat, May 12, 2018 at 6:53 PM grka2011 via Chromium-Extensions-Announce <chromium-...@chromium.org> wrote:

I may mention that the only thing I changed was to force my webseite to forwards from http to https with a htaccess file. Could this be the reason?

--
You received this message because you are subscribed to the Google Groups "Chromium-Extensions-Announce" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To post to this group, send email to chromium-...@chromium.org.
Visit this group at https://groups.google.com/a/chromium.org/group/chromium-extensions/.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/8ef9506c-6c86-4b29-9e14-cb0875dfc848%40chromium.org.
For more options, visit https://groups.google.com/a/chromium.org/d/optout.

grka...@googlemail.com

unread,
May 12, 2018, 2:35:29 PM5/12/18
to Chromium-Extensions-Announce
Yes that was the problem, I changed the POST to HTTPS and now it works :-)

puja...@gmail.com

unread,
May 12, 2018, 3:15:18 PM5/12/18
to chromium-...@chromium.org

gkiro...@gmail.com

unread,
May 12, 2018, 3:29:34 PM5/12/18
to chromium-...@chromium.org
Reply all
Reply to author
Forward
0 new messages