oldj
oldj

Reputation: 31

How to transfer data from one page to the next?

I have several sites with different domains. A customer may do something in page a.com/1.html, and some data was generated there. Then the customer may click a link in page a.com/1.html and be redirected to b.com/2.html, while b.com/2.html may be opened in the same window or a new window. Is there any front-end(JavaScript/HTML) method to transfer the data generated in a.com/1.html to b.com/2.html?

As the two page is not in the same domain, cookie/localStorage is not available here, and the next page may be opened in a new window so data could not be stored in window.name temporary, the data may be a bit long and for some reason we could not pass it through URL parameters. I don't need two-way communication between the two pages, what I need is the first page transfer the data to the next page, or the first one store the data in somewhere and the next one get it.

Is there any solution for this?

Thanks!

Upvotes: 0

Views: 1005

Answers (3)

qhwa
qhwa

Reputation: 73

Both sites can use flash SharedObject to store data. They can share datas if only they use swf files in the same domain.

However,flash is not an available solution for ios device. So think about it before using.

Upvotes: 0

sunshine1988
sunshine1988

Reputation: 1

Try window.showModalDialog() or window.showModallessDialog() in page a.com/1.html to open b.com/2.html in a new window or browser tag. The second param of the tow functions may be an object, in which you can put your datas from a.com/1.html and transfer it to b.com/2.html~~

Upvotes: 0

Peter-Paul van Gemerden
Peter-Paul van Gemerden

Reputation: 7011

If the data you're trying to transfer can fit in GET parameters, perhaps this is a viable solution:

  1. Pass the data along from a.com to b.com in GET parameters;
  2. Save the data at b.com in a cookie;
  3. Redirect to the same page (on b.com) without the parameters;
  4. Load the data from the cookie.

Upvotes: 1

Related Questions