Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6598585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:22:10+00:00 2026-05-25T18:22:10+00:00

I have a form on my page where users enter their credit card data.

  • 0

I have a form on my page where users enter their credit card data. Is it possible in HTML to mark the form’s action being constant to prevent malicious JavaScript from changing the form’s action property? I can imagine an XSS attack which changes the form URL to make users posting their secret data to the attacker’s site.

Is it possible? Or, is there a different feature in web browsers which prevents these kinds of attacks from happening?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T18:22:10+00:00Added an answer on May 25, 2026 at 6:22 pm

    This kind of attack is possible, but this is the wrong way to prevent against it. If a hacker can change the details of the form, they can just as easily send the secret data via an AJAX GET without submitting the form at all. The correct way to prevent an XSS attack is to be sure to encode all untrusted content on the page such that a hacker doesn’t have the ability to execute their own JavaScript in the first place.


    More on encoding…

    Sample code on StackOverflow is a great example of encoding. Imagine what a mess it would be if every time someone posted some example JavaScript, it actually got executed in the browser. E.g.,

    <script type="text/javascript">alert('foo');</script>

    Were it not for the fact that SO encoded the above snippet, you would have just seen an alert box. This is of course a rather innocuous script – I could have coded some JavaScript that hijacked your session cookie and sent it to evil.com/hacked-sessions. Fortunately, however, SO doesn’t assume that everyone is well intentioned, and actually encodes the content. If you were to view source, for example, you would see that SO has encoded my perfectly valid HTML and JavaScript into this:

    &lt;script type="text/javascript"&gt;alert('foo');&lt;/script&gt;

    So, rather than embedding actual < and > characters where I used them, they have been replaced with their HTML-encoded equivalents (&lt; and &gt;), which means that my code no longer represents a script tag.

    Anyway, that’s the general idea behind encoding. For more info on how you should be encoding, that depends on what you’re using server-side, but most all web frameworks include some sort of “out-of-the-box” HTML Encoding utility. Your responsibility is to ensure that user-provided (or otherwise untrusted) content is ALWAYS encoded before being rendered.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form where users can enter data that ultimately would be used
I have a php page where users may enter data into fields inside a
I have a JSF page where users can enter their car into my database.
I have an HTML page with a simple form. When the user clicks submit,
I currently have a JSP page with a Form for the user to enter
I'm trying to have users enter info into a form (via radio buttons), manipulate
I have pay now form on my page and after user finishes his payment
I have a user form that is working perfectly. The page makes use of
I have a canvas page with a form. When the user submits the form,
I have a child page LoginContent.aspx which contains a login form. If the user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.