views:

121

answers:

2

Is there any way to automatically fill in a textbox on a 3rd party website via code on the referring page?

My situation is thus: When a user clicks the pager number in our online phone directory, I've been asked to have that number filled automatically on the third party's site. They have no API.

Certainly Javascript can fill in the Textbox, but can I somehow do that from the referring 'href' tag?

THANKS, ALL!

+1  A: 

Javascript won't be of any help because the 3rd party page won't be loaded until you click on a link. So the only way is to pass it as parameter:

<a href="http://3rdparty.com/action?value=some_value"&gt;Call 3d party</a>

This parameter needs to be interpreted by the 3rd party page and populate the text box. Even if you opened the 3rd party site in a new window or iframe you won't be able to manipulate it with javascript because it probably won't be hosted on the same domain as your site.

Darin Dimitrov
+2  A: 

You're essentially asking for a Cross site scripting vulnerability on the third party site. So no, you cannot fill the forms of third party pages unless they have a vulnerability that you can abuse, or if the page is originally designed to fill the form using parameters from the url.

Kimmo Puputti
After wasting the better part of a day, I've found you're exactly right. Testing on my local machine works fine, but when I move across domains, I get security errors. Thanks for your answer!
John