开发者

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?


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.


Have you tried the Form Autofill feature?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜