+ 2

[SOLVED] HTML Button and webhook

I am looking at making a html page with buttons for home automation functions. I want icons/buttons which when pressed will send a webhook url for a given function. if there any way of launching the url (ie sending the webhook command) without opening in new window. I wish to remain on the original page? example URL for turning on fan "BBC.com" https://code.sololearn.com/W1nuiC81DrBq

19th Mar 2020, 1:53 PM
Olivia Mikayla
Olivia Mikayla - avatar
5 Answers
+ 4
Using location.href should send you to another website (url specified in quotes) without opening a new tab.
19th Mar 2020, 1:57 PM
Jax
Jax - avatar
+ 3
I think location.href = “website.com”; should do exactly that
19th Mar 2020, 1:54 PM
Jax
Jax - avatar
+ 2
Jax thank you I will try
19th Mar 2020, 2:49 PM
Olivia Mikayla
Olivia Mikayla - avatar
+ 1
Jax can you explain me more please
19th Mar 2020, 1:55 PM
Olivia Mikayla
Olivia Mikayla - avatar
+ 1
Salomcha
21st Mar 2020, 3:38 AM
Shaxriyor