我想将JavaScript对象/变量从页面传递到另一个页面。所以我可以使用数据的一些领域,我希望这个值是隐藏的,而不是可见的,而我的价值从一个页面到另一个我已经看到许多通过http参数传递的例子,我不希望并且会话变量在服务器端管理,因此无需在服务器端对该页面进行管理。
我想将值作为隐藏字段或值传递给下一个页。如何通过
window.location =website / nextpage.jsp打开新页面时将其传递到新页面。另外一个说明,我是初学者,所以如果这个问题似乎含糊不清,请抱歉。
解决方案假设您不想使用会话变量,Cookie或本地存储: 您不能隐藏一个参数,以便您的网站用户无法看到它。
如果您通过POST请求提交数据 - 您可以使用隐藏的表单元素。
< form method =post> < input type =hiddenname =statevalue ={YOUR PARAMETER}/>如果您使用window.location - 您必须使用GET请求来完成它
window.location =website / nextpage.jsp / param / {YOUR PARAMETER};
I want to pass javascript object/ variable from page to another. so that i can use data for some fields, i want this values to be hidden and not visible while i my passing value from one page to another I have already seen many examples of pass via http parameters, i dont want that and also session variables manage on server side, cause nothing has to be manage on sever side for that page.
i want to pass value as a hidden field or value to next page. how to pass it to new page when i open new page via
window.location="website/nextpage.jsp";Also a note, i am beginner, so please sorry if the question seems to vague.
解决方案Assuming you do not want to use session variables, cookies or local storage:
You can not "hide" a parameter so that your website user will not be able to see it.
If you submit data via a POST request - you can use hidden form elements.
<form method="post"> <input type="hidden" name="state" value="{YOUR PARAMETER}" />If you use window.location - you will have to do it with a GET request
window.location="website/nextpage.jsp/param/{YOUR PARAMETER}";
更多推荐
如何将javascript变量/对象从一个页面传递到另一个页面?
发布评论