[ERROR GAME] fix lỗi không load iframe gamedistribution.com for toplusgames.com (ok)

https://toplusgames.com

Về cơ bản chúng ta dùng thêm tham số này gd_sdk_referrer_url=https://gamedistribution.com/games/unblock-that/

C:\xampp82\htdocs\testcom\wp-content\themes\theme-zoki-child\singlegameh5.php

<?php
getallcat();
$ccid = '';
$ccidf = '';
$category_detail = wp_get_post_terms($id, 'game', array("fields" => "all"));
foreach ($category_detail as $cc) {
  $ccid .= $cc->term_id . ',';
  $ccidf .= '<a class="tag-item" title="' . $cc->name . '" href="' . get_category_link($cc->term_id) . '">' . $cc->name . '</a>';
}
$cat = str_replace(',,', '', $ccid . ',');
$cclink = get_category_link($category_detail[0]->term_id);
$ccname = '<a href="' . $cclink . '" class="play-tag show">Play Game: ' . $category_detail[0]->name . '</a>';
$title2 = get_the_title($id);
$link2 = get_permalink($id);
$kim1 = wp_get_attachment_image_src(get_post_thumbnail_id($id), 'medium');
$img2 = ($kim1[0] != '') ? $kim1[0] : "/static/images/no-img.png";
$html5game = get_field('html5game', $id);
?>
<div class="product-wrap ">
  <nav class="breadcrumbs-new">
    <?php if (function_exists('rank_math_the_breadcrumbs')) {
      rank_math_the_breadcrumbs('<div class="trail-items wide">', '</div>');
    } ?>
  </nav>
</div>
<link rel="stylesheet" type="text/css" href="/static/css/d-gameh5.css" />
<link rel="stylesheet" type="text/css" href="/static/games/all.css" />
<?php $siteUrl = home_url("/backk"); ?>
<script type="text/javascript">
  var siteUrl = "<?php echo $siteUrl; ?>";
  function Ajaxrequest() {
    return siteUrl + '/gm-request.php';
  }
</script>
<div class="main-single">
  <div class="main__content">
    <div class="grid-game gritop-games games-container">
      <p class="title">Best Games</p>
      <div class="game-wrapper">
        <?php getgh5(36); ?>
      </div>
    </div>
    <div class="grid-game new-games games-container">
      <p class="title">Editor's Picks Games</p>
      <div class="game-wrapper">
        <?php getgh5(37); ?>
      </div>
    </div>
    <div class="grid-game main-game">
      <div class="grid-game__conent">
        <div class="game-part">
          <div class="game-container">
            <div class="game-ready">
              <div class="ready-warp">
                <p class="ready-app-name"><?php echo $title2; ?></p>
                <div class="ready-app-icon">
                  <img src="<?php echo $img2; ?>" alt="<?php echo $title2; ?>" class="ready-app-img show" />
                </div>
                <button class="ready-play gamePlay-button" game-id="<?php echo $id; ?>" game-img="<?php echo $img2; ?>" game-link="<?php echo $link2; ?>" game-name="<?php echo $title2; ?>" onclick="addTogame(this)">PLAY
                  GAME</button>
                <p class="ready-tips">Game will start after a short ad. Thank you for your support.</p>
              </div>
              <div class="ready-bg bg-center" style="background-image: url('<?php echo $img2; ?>');"></div>
            </div>
            <div class="game-iframe">
              <div class="iframe-warp landscape">
                <div id="gameDiv">
                  <div class="gametitle fn-clear">
                    <div class="l-link">
                      <a class="home" href="<?php echo $cclink; ?>"></a>
                      <a class="back" href="javascript:history.back(); "></a>
                    </div>
                    <h1 class="gamename fn-left" title="<?php echo $title2; ?>"><i class="flag"></i><span><?php echo $title2; ?></span></h1>
                    <div class="game-share fn-right">
                      <div class="game-zoom">
                        <!--<a href="#" id="gameFull" title="Play game fullscreen" onclick="GameFullscreen();return false;"></a>-->
                        <a href="#" id="gameReplay" title="Replay this game" onclick="ReplayGame();return false;"></a>
                      </div>
                      <div class="social"></div>
                    </div>
                  </div>
                  <div id="ava-game_container" class="game-box" data-norate="1">
                    <div id="gamePlay-content" oncontextmenu="return false" style="position: relative;">
                      <img class="gamePlay-bg" src="<?php echo $img2; ?>" />
                      <img class="front-icon" alt="Icon" src="<?php echo $img2; ?>" />
                      <div class="front-title"><?php echo $title2; ?></div>
                    </div>
                    <style type="text/css">
                      .front-bg {
                        background: url(PiesFrescos) center/100% 100% no-repeat;
                      }
                      @media screen and (max-width: 488px) {
                        .front-bg {
                          background-image: url(PiesFrescos);
                        }
                        .front-icon {
                          left: calc(50% - 50px);
                          width: 100px;
                          height: 100px;
                        }
                      }
                    </style>
                    <div id="pre-count">
                      <font lib="game-loading">Game loading..</font>
                      <div id="pre-count-num">25</div>
                    </div>
                    <div id="game-preloading"></div>
                    <div id="game-preloader"></div>
                    <div id="game-box"></div>
                    <div id="adsContainer">
                      <div id="adContainer"></div>
                      <video id="videoElement"></video>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <div class="game-bar">
            <div class="bar-app-icon">
              <img class="bar-app-img" src="<?php echo $img2; ?>" alt="<?php echo $title2; ?>" />
            </div>
            <p class="bar-app-name text-cut"><?php echo $title2; ?></p>
            <div class="bar-btns">
              <button id="installApp" class="down-app show">
                <img class="down-icon" src="/static/images/vdownload2.png" />
                <span class="down-tips">Add to Desktop</span>
              </button>
              <?php echo $ccname; ?>
              <button class="full-btn">
                <i class="full-icon">
                  <svg class="icon" aria-hidden="true">
                    <use xlink:href="#iconfullscreen"></use>
                  </svg>
                </i>
                <p class="full-tip">Full Screen</p>
              </button>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="grid-game main__desc">
      <div class="game-desc">
        <div class="desc-section">
          <p class="desc-title"><?php echo $title2; ?></p>
          <div class="desc-text"><?php the_content(); ?></div>
        </div>
      </div>
      <div class="clearfix"></div>
      <div id="licomments"></div>
      <div class="easetv-comments-wrapper commentgame5">
        <?php
        if (comments_open() || get_comments_number()) :
          comments_template();
        endif;
        ?>
      </div>
    </div>
    <div class="grid-game">
      <p class="title">Exclusive Games</p>
      <div class="game-wrapper game-wrapper--justify">
        <?php getgh5(38); ?>
      </div>
    </div>
  </div>
</div>
<div theater-mode="" class="gamemonetize-page-tree gamemonetize-container">
  <script language="javascript">
    var PageType = "";
    var ids = "";
  </script>
  <script type="text/javascript">
    $(function() {
      var columnWidthValue = 185;
      let isMobile = window.matchMedia("only screen and (max-width: 600px)").matches;
      if (isMobile) {
        columnWidthValue = 130;
      }
      window.addEventListener("resize", function(event) {
        var columnWidthValue = 185;
        let isMobile = window.matchMedia("only screen and (max-width: 600px)").matches;
        if (isMobile) {
          columnWidthValue = 130;
        }
      });
      if (PageType == "games" || PageType == "best") {
        $(window).scroll(function() {
          if ($(document).scrollTop() + $(window).height() > $(document).height() - 500) {
            if (!loading) {
              loading = true;
              jsonajax(30);
            }
          }
        });
      }
      var LoadedGamesNum = 0;
      var loading = false;
      function jsonajax(e) {}
    });
    if (typeof PageType !== "undefined") {
      if (PageType == "played") {
        $(".bottomtext").hide();
      }
    }
  </script>
  <script src="https://api.gamemonetize.com/cms.js?1681963740"></script>
</div>
<script type="text/javascript">
  var PreGameAdURL = "";
  function getcookie(name) {
    var cookie_start = document.cookie.indexOf(name);
    var cookie_end = document.cookie.indexOf(";", cookie_start);
    return cookie_start == -1 ? '' : unescape(document.cookie.substring(cookie_start + name.length + 1, (cookie_end >
      cookie_start ? cookie_end : document.cookie.length)));
  }
  function setcookie(cookieName, cookieValue, seconds, path, domain, secure) {
    var expires = new Date();
    expires.setTime(expires.getTime() + seconds);
    document.cookie = escape(cookieName) + '=' + escape(cookieValue) +
      (expires ? '; expires=' + expires.toGMTString() : '') +
      (path ? '; path=' + path : '/') +
      (domain ? '; domain=' + domain : '') +
      (secure ? '; secure' : '');
  }
  function ClearPlayedGames() {
    setcookie("lastplayedgames", "", -360000, "/");
    return false;
  }
  function PlayedGames(game_id) {
    var playedgames = getcookie("playedgames");
    if (playedgames.indexOf("," + game_id + ",") > -1) {
      playedgames = playedgames.replace("," + game_id + ",", '');
    } else {
      if (playedgames == "" || playedgames == ",") {
        playedgames = "," + game_id + ",";
      } else {
        playedgames = "," + game_id + "," + playedgames;
      }
    }
    $('#game-box').show();
    setcookie("playedgames", playedgames, 25920000000, "/");
  }
  $(document).ready(function() {
    PlayedGames(2412);
  });
  window.setTimeout(function() {
    __upGame_rx8(2412)
  }, 2000);
  var descriptionURL = "<?php echo $link2; ?>";
  var iframe =
    '<iframe src="<?php echo $html5game; ?>" id="game-player" width="100%" height="100%" frameborder="0" scrolling="no" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>';
  $(document).ready(function() {
    //$('.gamePlay-icon, .gamePlay-button, #gamePlay-content').click(function(e) { 
    $('.gamePlay-button').click(function(e) {
      $('#adsContainer').show();
      $("#gamePlay-content").hide();
      $(".game-ready").hide();
      $("#game-preloading").show();
      setTimeout(
        function() {
          $("#game-preloading").hide();
          PreRollAd.start();
        }, 550);
    });
  });
  function SkipAdAndShowGame() {
    $("#adsContainer").hide();
    $("#game-box").html(iframe);
  }
  $(function() {
    $('.ad300').eq(0).show();
    if ($('.ad300').size() > 1) {
      setInterval(function() {
        var first = $('.ad300').eq(0);
        first.hide();
        $('.ad300').last().after(first);
        $('.ad300').eq(0).fadeIn();
      }, 3000);
    }
    $('.adsmall').eq(0).show();
    if ($('.adsmall').size() > 1) {
      setInterval(function() {
        var first = $('.adsmall').eq(0);
        first.hide();
        $('.adsmall').last().after(first);
        $('.adsmall').eq(0).fadeIn();
      }, 3000);
    }
  })
</script>
<script type='text/javascript' src='//imasdk.googleapis.com/js/sdkloader/ima3.js'></script>
<script type='text/javascript' src='//api.gamemonetize.com/imasdk.js?1681965900'></script>
<script src="/static/js/game/global.js"></script>
<script src="/static/js/game/jquery.masnory.min.js"></script>
<script src="/static/js/game/gamefree.js"></script>
<script src="/static/js/game/general.js"></script>

Last updated