A
A
Arseniy Sokolovsky2021-06-22 21:37:01
JavaScript
Arseniy Sokolovsky, 2021-06-22 21:37:01

How to transfer data between pages if they are opened on different devices (on the same site)?

In short, there is, for example, the site ggg.com and it has two pages pc.html and phone.html and there is, for example, the main.js script. The script generates a number from 0 to 4000. For example, we got 3679 and this number was displayed on the pc.html page (this page is open on a PC), then on the phone we go to the site, only to the phone.html page and we have an input, there we enter the number that seemed to us on pc.html and if they match, then the message "Connected" appears on the pc.html page.
Is there any way to do this in pure js? If not, then maybe php and js or just php.
Who can help or tell me what to do? Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Timoshenkov, 2021-06-23
@SokolarGm

It is possible through a session on the server:

  • On both devices, the user must be authorized by the same account
  • When calling the page from the first device, put your number in the session and display it on the page
  • On the second device, when requesting a page, first check that the session already has a number and show it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question