Autofill forms

Posted on 2011-04-20
Last Modified: 2012-05-11
I have a webpage that loads a form from another website in an iframe.

Is it possible to search for form labels such as "username" and autofill the input box?
Question by:Luv2Muff
    LVL 42

    Accepted Solution

    No. The same origin security policy prevents that.

    Sometimes you can copy the page to your server (I'd use CURL with PHP) and use it to display the form instead of displaying the page from the other domain directly. When you use the copy from the same domain as your other pages, you add whatever JavaScript scripts to the page that you'd like.
    LVL 6

    Expert Comment

    Well, if I understand the question correctly, you can just store the username in a session-variable. That way, you can reach it from every page on the site.

    If you have a variable with the username called $username then you could say:
    $_SESSION['username'] = $username;

    Open in new window

    Now you can get that username on the other site like this:
    echo $_SESSION['username'];

    Open in new window

    More on sessions here:

    LVL 12

    Expert Comment

    by:Mohamed Abowarda
    If you want to access DOM elements inside Iframe from the parent, take a look here:

    Author Closing Comment

    Thanks thanks, hope you are wee.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Part of the Global Positioning System A geocode ( is the major subset of a GPS coordinate (, the other parts being the altitude and t…
    JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now