Suppose I have a form that is making a message right now:
<form id="post-form" class="post-form" action="/questions/ask/submit" method="post">
You will notice that there is no site in action , the browser follows where it got the page from.
The browser follows the current domain rules when publishing
If the current page is... then the browser will POST to ======================================= ============= http://stackoverflow.com/questions/ask http://stackoverflow.com/questions/ask/submit https://stackoverflow.com/questions/ask https://stackoverflow.com/questions/ask/submit
But I want the browser to always go to a secure page:
http://stackoverflow.com/questions/ask https://stackoverflow.com/questions/ask/submit
Usually you try something like:
<form id="post-form" class="post-form" action="https://stackoverflow.com/questions/ask/submit" method="post">
Except that it requires knowledge of the domain and the name of the virtual path for the hosting site (for example, stackoverflow.com ). If the site has been changed:
stackoverflow.netstackoverflow.com/mobilede.stackoverflow.comstackoverflow.co.uk/frbeta.stackoverflow.com
then it would also be necessary to update the action form:
<form id="post-form" class="post-form" action="https://stackoverflow.net/questions/ask/submit" method="post"> <form id="post-form" class="post-form" action="https://stackoverflow.com/mobile/questions/ask/submit" method="post"> <form id="post-form" class="post-form" action="https://de.stackoverflow.com/questions/ask/submit" method="post"> <form id="post-form" class="post-form" action="https://stackoverflow.co.uk/fr/questions/ask/submit" method="post"> <form id="post-form" class="post-form" action="https://beta.stackoverflow.com/questions/ask/submit" method="post">
How can I tell the browser to switch to the https version of the page ?
Hypothetical syntax:
<form id="post-form" class="post-form" action="https://./questions/ask/submit" method="post">
html google-chrome internet-explorer-9
Ian boyd
source share