jfanals
jfanals

Reputation: 1006

How to copy and paste text from one page to another page using jquery?

I have to copy repeatedly data (contact info such as name, surname, telephone...) from form A (page 1 in domain x.com) to form B (page 2 in domain y.com)

I have been thinking about creating a chrome extension with the help of jquery to copy the data from form A, and inject it form B...

I have a feeling that this is not the best way to solve this problem...

What do you think is the best way to copy and paste data from pages in different domains?

Upvotes: 1

Views: 2020

Answers (3)

Abe Voelker
Abe Voelker

Reputation: 31574

I'm not a web developer, but I think doing this in pure JavaScript shouldn't be possible (see same origin policy).

You're probably better off coding something at the server level to handle this, perhaps making a proxy web service on x.com that talks to y.com to do what you need. But the client-side JavaScript running on x.com shouldn't really know about y.com.

EDIT:

Ah now I see; I was thinking that you were coding a Web application for everyone to use. If this is something personal that only you need functionality for, then I might recommend writing a Firefox Greasemonkey script to inject into your x.com code, as Greasemonkey does allow cross-site XMLHttpRequests (Ajax). This would allow you to call a web service running on y.com from your x.com Greasemonkey Javascript. I'm sure you could achieve the same thing using a Chrome extension as you mentioned.

Upvotes: 1

user406905
user406905

Reputation: 1418

depends on what your target browsers are. you MAY be able to use some persistent storage api. there are some good wrappers that will abstract the cross browser issues.

but you have size constraints. and may have cross domain issues.

Upvotes: 0

D.Shawley
D.Shawley

Reputation: 59563

Have you tried the Form Autofill feature?

Upvotes: 0

Related Questions