Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The B button isn't working properly #6

Open
CarlosEFML opened this issue Feb 19, 2021 · 1 comment
Open

The B button isn't working properly #6

CarlosEFML opened this issue Feb 19, 2021 · 1 comment

Comments

@CarlosEFML
Copy link

The behavior of the B button is awkward. Maybe you should try a different approach than the iframe.
The following snippets was tested on switch browser and worked very well.

Using window.location.hash:

<html>
<script>
var cnt = 0;

window.location.hash = "#1";
function beginHistory() {
  window.location.hash = "#2";
  setInterval(function(){
    if (window.location.hash != "#2") {
      window.location.hash = "#2";
      ++cnt;
      document.getElementById('content').innerHTML = 'PRESS #' + cnt;
    }
  }, 1);
}

setTimeout(function(){beginHistory();}, 1);
</script>

<div id='content'></div>
</html>

Using HTML5 pushState: (dont know why, but this doesn't work on my Chorme)

<html>

<script>
var cnt = 0;

history.pushState("#1", null, "");
function beginHistory() {
  history.pushState("#2", null, "");
  window.onpopstate = function(event) {
    history.pushState("#2", null, "");
    ++cnt;
    document.getElementById('content').innerHTML = 'PRESS #' + cnt;
  };
}
setTimeout(function(){beginHistory();}, 1);

</script>

<div id='content'></div>

</html>

the second one is better, because it does not rely on a interval polling the hash value.

@BFriedrichs
Copy link
Owner

Hey, this looks pretty good, I would be willing to merge a PR.

I'm not actively working on this project at the moment as the switch browser currently doesn't support proper audio streaming. I did see there is a different way to open the browser through the social login which enables video playback but I'm not really interested in having to jump through that many hoops.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants