Andrew
Andrew

Reputation: 2363

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.

Upvotes: 5

Views: 3407

Answers (1)

i100
i100

Reputation: 4666

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

Upvotes: 1

Related Questions