我需要我的网页引导人们到网站的https部分,只有在这个预订系统的第三步,我有,我不希望整个网站运行在https上。
基本上,我拥有一家汽车租赁公司,并希望人们在https服务器上填写的信息部分,我已经有证书,它在我的网站上工作。
这里的代码位于我希望他们点击的页面上,它带他们到另一个页面,但是使用https:我如何使这个javascript代码输出一个https链接,而不是它现在输出的链接。
<div class="button" style=""><a href="javascript:processFeesPage();"> <?php l_e("Click to continue"); ?></a></div>基本上
<script type="text/javascript">
function processFeesPage()
{
var feeschart;
feeschart = MM_findObj('feeschart');
objtotaltotaltax = MM_findObj('totaltotaltax');
// save with Ajax, cleaning a bit the code and go to step-4 (customer details)
var http_request = getRequestAjax();
http_request.open('POST','<?php echo VIRTUAL_ROOT; ?>scripts/saveformajax.php', false);
var parameters = '';
parameters = encodeParam('rentalitems',feeschart.innerHTML);
parameters = parameters + "&" + encodeParam('totalcost',objtotaltotaltax.innerHTML);
parameters = parameters + "&" + encodeParam('pricereturn','<?php echo $pricereturn; ?>');
for (var i in selected_values)
parameters = parameters + "&" + encodeParam(i,""+selected_values[i]);
http_request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1;");
http_request.setRequestHeader("Content-Encoding", "iso-8859-1");
http_request.setRequestHeader("Content-Length", parameters.length);
http_request.setRequestHeader("Connection", "close");
http_request.send(parameters);
document.location= './step-4';
}
</script>发布于 2014-01-22 05:56:44
这条线
document.location= './step-4';使用当前上下文生成整个url:http://rentacar.com/step4
因为您现在想切换到一个新的protocol (https),所以不能使用当前使用的.快捷方式。
您可以选择完整的路径:
document.location= 'https://rentacar.com/step4'或者,您可以尝试以编程的方式解决这个问题。例如:
var currentUrl = 'http://' + window.location.hostname + '/step4'https://stackoverflow.com/questions/21274586
复制相似问题