pre-populating web pages

Is it possible to link to a site and prepopulate fields on their home page without passing parameters.
Our website is linking to a business partner's website and would like to pass information to their home page and prepopulate certain fields.
They cannot allocate resource to amend their site to accept parameters.

I have seen this done with some web sites and I think that they did this using java applets. I just wondered if anybody had done something similar with applets or other development software and could point me to any useful documentation.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

arantiusConnect With a Mentor Commented:
Online demo here, including faked 5-second delay to show the onload delay works properly:

Two files: Q_21175107.html and Q_21175107b.php .  The php file represents the remote site, the html file you would make.  Here are my examples followed by explanation:

function fillOtherForm() {

<frameset rows="*" onload="javascript:fillOtherForm();">
      <frame src="Q_21175107b.php" name="b">



<body >

This is a test... the page should load in around 5 seconds.

<form name="otherForm">
<input type="text" name="textField"><br>
<input type="submit">


The html file above puts the "remote site" in a frame, and attaches a javascript function to the onload event of that frameset.  This makes sure that the forms in that page will be loaded when we try to populate them.
The function it calls references "window.frames" and inside that b, the name of the inner frame, then the form element as usual, assuming names on the form and the form element, and assigns it a value.

The PHP file is not terribly important, as it is just an example and in reality you are saying you have no control of it.  I just wrote it up to include the PHP call to sleep() to simulate a page that takes a few moments to load, to make sure it all still worked.
[ fanpages ]IT Services ConsultantCommented:
There are many ways (cookies, query string parameters as you said, active scripting reading data files, database retrieval, and so on) this can be achieved, but if your business partner cannot (or will not) amend their site accordingly to accept the parameters, then perhaps the only method is by using an "input recording" software product that tracks your interaction (mouse movements, clicks, scrolling, typing, button pressing, etc) with your environment and can then "replay" this in the future to emulate what you did manually on the previous occasion.


rexjohnsonAuthor Commented:
This is fine if you are trying to achieve populating a web site from a browser under your control (in fact we do this as part of our business process) but what we are trying to do here is customer orientated.

The customer navigates our site and we have software that will take their input and populate partner web sites with this data.

At a later point in the web process we direct the customer to a partner's site where currently they need to reenter key details. What we want to do is prepopulate those key details on the partner's web site.
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Hmmm, one way I can see, but its sort of a 'hack' and depends a lot on your partner's form validation implementation, would be to submit your information to the receiving script. If the latter has been well coded, it should return you to the form (actually, not *return* since you have skipped that part) with some error messages stating what fields haven't been populated.

For example, if your partner's site 'GETs' email, firstname and lastname information to 'formprocess.php', and YOUR form has room for a name and firstname fields, **MAYBE** linking to 'formprocess.php?name=MyName&firstname=MyFirstName' will get you to the form page with 'name' and 'firstname' already populated but 'email' being left empty and a message telling the user something like 'Email field is a required field'.

Of course, that depends a lot on your partners implementation. Maybe try logging to their form and seeing what happens when a few field aren't set. If the resulting page is too disorienting to a user, forget it, but if it brings up the form with nice 'Warnings: This field is required information' or such, it could be a good workaround that doesn't involve java applets or other software running on the client side.
The correct way to do it is to handle it on your server. Setup the links on you pages that get the partner pages to point at a script on yur server.  Then go server to server to bring in the page, and you can do whatever you need ot do before returning it to the user.

[ fanpages ]IT Services ConsultantCommented: you are offering a "valued added" front-end to various partner "back end" web sites, and in order to obtain data from the partners you populate their web form-based fields, submit to their server(s), and scrape the results back to your site?  But later in the process, the same data needs to be re-input into form-based fields as a verification check?

It really sounds like you need a bespoke communications channel to the partners' servers (as discussed by Cd&).

However, I guess what your partners are saying is that they cannot justify the expense of allocating a resource.

Depending on the revenue your "value added" service generates, could you not offer to fund a resource for your respective partners?

What technologies are used?  Perhaps this would give us a better idea at suggestions?



sigmaconConnect With a Mentor Commented:
If its possible, PaulPosition's solution would be the most elegant: Linking to yout partner's site using url paramters. But, if you are sending personally identifying data, there are privacy/security concerns. Submitting a form from your site to your business partners site would be another solution, but with similar security implications. So, if all that is not an option, there is a possibility to achieve what you are trying to do using whatever system/language you run on your webserver and javascript on the client. Downside of this solution is, of course, that it depends on the client having javascipt enabled, which is the case for over 98% of the visitors most sites see.

Here is how it would work: You generate a page that has your customers data embedded in an appropriate piece of dynamically created JavaScript. This script opens a new window, loads your business partners website and populates the fields in that form using JavaScript. Of course you will need to know the exact names of all form fields in your partners page, which can be determined by lookind at the source of the page. Everytime they change their form, you will have to change your script.

Another, VERY RESOURCE-intensive hack would be to perform a backend http request to your business partner's website and serve it as if it is part of yours. But this is a very big and ugly hack (it does work though, albeit being slow and cumbersome to implement).

If you want code samples, please provide more information about what software you are using.
rexjohnsonAuthor Commented:
We are using java jsp/servlet technology for our web site running under websphere 5.

I like the idea of simulating the form input to heading directly into the back end process that deals with the form but I think that this would probably still involve our partners although perhaps not to the  same extent as the parameter processing solution.

I would like the code samples for a javascript solution from sigmacon. We try to minimise the javascript we because it can be disabled and also because of the variations on different browsers but in the case of this javascript not working the customer would still be able to enter their key details manually.

Thanks for the ideas

arantius showed essentially what I suggested, instead of using frames I would use, in JavaScript:

var newWindow = ...
and then refer to the form fields with newWindow.document.forms ...

But either way would work. The advantage of arantius' approach is that it would still show your partners page, even when JavaScript is disabled. In my solution, you page would simply provide another link to your partners page within a <noscript> tag.
rexjohnsonAuthor Commented:
I have tried the solution from Arantius and while this works when you are populating a page in the same domain it does not work with cross-domain population - it gives an access error.

I believe you could do this type of thing with old versions of I.E. but they introduced this block as a security measure

You are right about that, permissions in newer browsers usually prevent this cross-site scripting. The next possible solution then would be something similar to what Paul suggested:

Build a copy of your business partners form on your side, populate it with the appropriate form values - making sure that there is at least one error in the form that prevents it from just being accepted as completed by the other site, if that's what you want - and do something like this in the body of the page you generated:


The action attribute in your form tag points to your business partner's page handling the form submission. Pre-populate the form fields simply by setting the value="..." parameter for each form field. I have done this kind of form submission based on data from a site I worked on to someone else site often and it works, no matter whether they use GET or POST as their methods. You may want to make all form fields hidden, so that the user is not necessarily disturbed by your hacking their personal information away across the net ... ;-)

You may also just give them a submit button, informing them that by pressing the submit button, they will and their personal information will be forwarded to another site. If you do that, you don't even need JavaScript.
"with cross-domain population - it gives an access error."

Whoops!  I had intended to test that but forgot once I had it finished.  Too bad!
Simple [Web Service] should take care of what you are trying to accomplish I think
split sigmacon and arantius. They brought it as close as it can get within the contraints of the requirements.  IMHO.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.