0

I was using jsbin to test some code, related to iframes, here is the link to my work http://www.jsbin.com/evidez/1/edit

By mistake I set the url of the iframe to http://stackoverflow.com, now when http://www.jsbin.com/evidez/1/edit loads, then an alert popups and upon closing it it redirects to http://stackoverflow.com.

I can't find any way to edit my jsbin code.

Is there a way out or do I have to start all over again?

Tomarinator
  • 782
  • 1
  • 11
  • 28

1 Answers1

1

I wrestled with my browser and salvaged this for you. Be careful next time.

HTML

<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
  <title>Full Screen Example</title>
</head>
<body>
  <button id="fullsc">set source to iframe and take me full screen</button><br><br>

  <iframe id="myvideo" src="http://stackoverflow.com"></iframe>


</body>
</html>

CSS

/* make the video stretch to fill the screen in WebKit */
    :-webkit-full-screen #myvideo {
      width: 100%;
  height: 100%;}

iframe{
  position: absolute; 
  height: 100%; 
  width:100%
}

Javascript

var videoElement = $('#myvideo');
var fullsc = $('#fullsc');



  function toggleFullScreen() {
    if (!document.mozFullScreen && !document.webkitFullScreen) {
      if (videoElement.mozRequestFullScreen) {
        videoElement.mozRequestFullScreen();
      } else {
        videoElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
      }
    } else {
      if (document.mozCancelFullScreen) {
        document.mozCancelFullScreen();
      } else {
        document.webkitCancelFullScreen();
      }
    }
  }

  document.addEventListener("keydown", function(e) {
    if (e.keyCode == 13) {
      toggleFullScreen();
    }
  }, false);


fullsc.onclick = function(){
  //setiframeurl();
  toggleFullScreen();
};

function setiframeurl(){
  $('#myvideo').attr('src', "http://radbox.me/watch/mobile?c=21&du=35");

}
Antony
  • 14,900
  • 10
  • 46
  • 74
  • 1
    @Tomarinator I tired every browser I've got and tried to pause javascript from the console. It didn't work. It turned out that I just have to stop the loading of the page at the right time to get all the data before the alert pops up. – Antony Jan 30 '13 at 10:51