Manu Mathew
Manu Mathew

Reputation: 487

How to submit a form without Javascript and not by pressing any buttons?

How can we submit a form without Javascript and not by pressing any buttons?

I need to transfer a content to another file when a function works under certain conditions. Both the files are written in Perl. The pages are loaded in a webserver(same). I need to transfer a value, which the user doesn't want to know what I'm sending. So I came up with the post method is safe.

But there I didn't find any ways to redirect a URL where the values are transmitted in post method. So I came up with the form submission. But the problem is I need to use javascript or make user to press a button to complete the task.

The problem with Js is there some users who disable JS in their browsers. So using it is not preferable. With the button, I can't make the user to do that for me.

Is there any other scripting language, which supports such functionality?

There are some conditions that I can't use session

What I did is encryption for identifying the user from knowing what data is transmitted. The receiving page will decrypt it when it is required. But it's not what I needed.

Upvotes: 0

Views: 199

Answers (2)

Axeman
Axeman

Reputation: 29854

  • You can't make a user do anything, unless you're writing for a browser the equivalent of a trojan.
  • But secondly, without something on the client side, you can't ensure that you can get information that you didn't have when you sent the page.

You could place some links, and know which links they clicked on by passing it through a central tracking program, but those links wouldn't have anything in them that didn't originate on the server without client script running.

Still, despite that you can entice a user to click on a link more than a simply functional button, in either case you can't get guaranteed new information from them. They can always close the tab, close the browser, or press the back button. This goes back to point #1: you can't make users do anything.

Upvotes: 0

Quentin
Quentin

Reputation: 943591

I need to transfer a value, which the user doesn't want to know what I'm sending. So I came up with the post method is safe.

It isn't. If you pass it through the user's browser, then the user can see it.

Is there any other scripting language, which supports such functionality?

No. There is no programming language as well supported in browsers as JavaScript, and none that are harder to disable then JS.


Store the value on the server (you could use a session) and redirect the user with a normal 302 status and Location header. You can pass a session token via cookies or the query string.

Upvotes: 2

Related Questions