0

I'm making some buttons, that when one is clicked, it will send a message of "1" to another page. If button 2 is pressed, it will again send a message to the other page saying "2" or something. How can I accomplish this, so it will send a message to another page and I can go there to review the message or number? Can this work in javascript or jquery?

Akidus
  • 191
  • 11
  • 1
    what is "another page"? I ask, because as a browser, I have no idea what that is. – Mike 'Pomax' Kamermans Jan 30 '16 at 22:38
  • Like, I'm on index.html, and it will go to codes.html or something. – Akidus Jan 30 '16 at 22:45
  • can use localStorage and when new page loads check what is stored. Really need more details on use case – charlietfl Jan 30 '16 at 22:46
  • no, seriously. The browser doesn't know "other pages". The one you're on is all you get. Another page, as far as the browser is concerned, is a completely different website. So you'll need to do data synchronization. That means either websockets via a server (so you can do data pushing), or storing domain-specific information for syncing via localStorage (but then you'll need to constantly check localStorage and that eats into the cpu), etc. etc – Mike 'Pomax' Kamermans Jan 30 '16 at 22:47

1 Answers1

1

Hard to answer without knowing how you navigate between pages.

Assuming that you use window.location, in your onbuttonclick method, you could just append urlparameters like window.location = othersite.html?message=1 and then read it on that other site as mentioned here: How to get the value from the GET parameters?

Community
  • 1
  • 1
Jens
  • 46
  • 3