user3562644
user3562644

Reputation:

How to hide value in URL

192.168.178.83:18300/Zupdate_we_view.act?name=bunnavitou&position=Research111&sex=Male

hide value on url

from this one :

192.168.178.83:18300/Zupdate_we_view.act?name=bunnavitou&position=Research111&sex=Male

==>To this :

192.168.178.83:18300/Zupdate_we_view.act?

Need Help !! JAVA or JAVA SCRIPT

Upvotes: 1

Views: 1400

Answers (4)

Sunny
Sunny

Reputation: 308

Another way is to encode the values on first page & pass those values and decode the value  
on second page.

Using that technique you have no need to post data. User can also read the parameter but 
it is encoded not the real value.

You can use different algorithm to encode/decode parameter on both side.

Upvotes: 0

Yubaraj
Yubaraj

Reputation: 3988

The best way to hide values on url is to use POST method.

Click HTTP Methods: GET vs. POST or GET vs POST

for more info about GET and POST methods.

Upvotes: 1

Lord Grosse Jeanine
Lord Grosse Jeanine

Reputation: 1131

First you have to get the url, modify it, and then with javascript replace the "true" url with the one you just modified. Here is what I would do:

//get the url
$old_url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

//then you modify it
$new_url = ...; 

//then with javascript you replace the url with the new one
<script type="text/javascript">
   if(new_url != '')
   {
      window.history.replaceState({"html":'Title',"pageTitle":'Page Title'}, '', new_url);
   }
</script>

This should do the trick, if you really want to use GET ; POST would be better, and you wouldn't have to hide the GET parameters.

Upvotes: 0

sKopheK
sKopheK

Reputation: 173

Like others suggested, use POST method, but if you want to stick with GET and JavaScript solution is enough (values can be seen in request same as with POST, but furthermore users with disabled JS will see the values), you can use approach described here: https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history

Upvotes: 0

Related Questions