-3

I would like to add some code to my script so i can logout from yahoo.com at the moment the button i set to display time. I was thinking about deleting some browser cookies with a script but how ?

<!DOCTYPE html>
<html>
<body>

<h1>Press the button to logout</h1>

<button type="button"
onclick="document.getElementById('demo').innerHTML = Date()">
Logout</button>

<p id="demo"></p>

</body>
</html> 
overtkill
  • 5
  • 1
  • 1
  • 1
    where's the code regarding cookies? by the way, you can't clear yahoo.com cookies from your web site, nor can you cleat httponly cookies from ANY websote – Bravo May 10 '22 at 12:40
  • 3
    You can't delete a cookie from another site. Think of the security chaos it would cause if one site could interfere with another like that! – ADyson May 10 '22 at 12:41
  • 1
    Also, how on earth does `document.getElementById('demo').innerHTML = Date()` "logout"? – Liam May 10 '22 at 12:42
  • 1
    @Liam tbf from the question text I think that's some existing functionality to show the current date, not an attempt to implement the logout. – ADyson May 10 '22 at 12:43
  • But the button has the text "logout" :D and the paragraph above it says "Press the button to logout" :DD – Liam May 10 '22 at 12:43
  • 1
    @Liam well yeah, but I think that was more in hope than anything else! `at the moment the button i set to display time` suggests the Date() code is intentional. – ADyson May 10 '22 at 12:44
  • I shouldn't laugh but.... :DD – Liam May 10 '22 at 12:44
  • 1
    I suppose you could write a custom browser plugin of some sort which would delete cookies from specific domains, all domains, whatever other functionality you like. And then you could use JavaScript to invoke that custom browser plugin. It seems like a lot of work to avoid clicking "logout" before leaving Yahoo. – David May 10 '22 at 12:45
  • Unfortunately they've made this ^ mistake [at least twice](https://stackoverflow.com/questions/72178085/html-with-instructions-to-trigger-an-event) – Liam May 10 '22 at 12:48

0 Answers0