I need to delete cookie on another domain (controlled by me) without reloading page and opening new window. I'm trying:
var XHR = window.XDomainRequest || window.XMLHttpRequest
var xhr = new XHR();
var url = another_domain_url_which_removes_cookie;
xhr.open('GET', url, true);
xhr.send()
but still after hitting target url cookie remains. If I change code to:
var url = another_domain_url_which_removes_cookie;
window.open(url)
it all works OK. Server code which removes cookie is the following (python/werkzeug):
response = Response({}, mimetype='application/json')
response.delete_cookie('cookie_name')
Do you guys have any idea how to make it work if this possible?
Try posting your request in a hidden iframe of your doc...
Html
<iframe style="display:none;" id="myiframe"/>
Js
$("#myiframe").src(url);