Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can window.location change from https to http

I have a store receipt window in https. I want to use window.location to change the location from https to http.

I have code like this.

var currentHost = window.location.host;
window.location.href = "http://" + currentHost + "/store/closeStoreWindow?gotoUri=" + url

It goes to the url I expect, but it still is https. It's like some security thing is blocking a change in protocol.

Should this work?


Opps. I think I may have discovered a filter in the app that is causing it to redirect back to https. So the window.location probably works just fine. Sorry about that.

like image 757
Andrew Avatar asked Nov 15 '22 03:11

Andrew


1 Answers

server might be forced to use always HTTPS. If this is the case you cannot change this from your client side JavaScript. If your code passes required URL and you get a response from HTTPS then this is the case.

Ivo Stoykov

like image 177
i100 Avatar answered Dec 19 '22 22:12

i100