Only Google Chrome?

0 favourites
  • 11 posts
From the Asset Store
Google Analytics 4 Plugin for Construct 3 enables metrics and analytics for your games easily.
  • How to make so that game it was started only in Google Chrome?

    I did so:

    <img src="http://dl.dropbox.com/u/50657347/Image93.png" border="0" />

    But it doesn't work in Linux, as FPS <60 in Chrome.

    Game Angry Birds example in Opera:

    <img src="http://dl.dropbox.com/u/50657347/Image94.png" border="0" />

  • I would do it with a bit of javascript and css.

    This is the javascript part, then you could make a not chrome div in the html and show it.

    var userAgent = navigator.userAgent.toLowerCase();

    $.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());

    // Is this a version of Chrome?

    if($.browser.chrome){

       //INITIALIZE CONSTRUCT

    } else {

       $("#div-nochrome").show();

    }

  • Thanks

  • It is impossible to me. It is possible to set an example?

  • This si the index.html that construct generates, open it and change everything to this:

    <!DOCTYPE html>

    <html manifest="offline.appcache">

    <head>

        <meta charset="UTF-8" />

         

         <!-- This ensures the canvas works on IE9+. Don't remove it! -->

         <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8" />

         

         <title>Test</title>

         <!-- Note: running this exported project from disk may not work exactly like preview, since browsers block some features on the file:// protocol. Once you've uploaded it to a server, it should work OK. -->

         

        <!-- This outlines the canvas with a black border. -->

         <style type="text/css">

              canvas { border: 1px solid black; }

         </style>

    </head>

    <body>

         <div id="fb-root"></div>

         <div style="text-align: center;" id="canvas-container">

            <!-- The canvas the project will render to. If you change its ID, don't forget to change the

            ID the runtime looks for in the jQuery ready event (above). -->

              <canvas id="c2canvas" width="640" height="480" oncontextmenu="return false;" onselectstart="return false;">

                <!-- This text is displayed if the visitor's browser does not support HTML5.

                You can change it, but it is a good idea to link to a description of a browser

                and provide some links to download some popular HTML5-compatible browsers. -->

                   Your browser does not appear to support HTML5. Try upgrading your browser to the latest version. <a href="http://www.whatbrowser.org">What is a browser?</a>

                   <br/><br/><a href="http://www.microsoft.com/windows/internet-explorer/default.aspx">Microsoft Internet Explorer</a><br/>

                   <a href="http://www.mozilla.com/firefox/">Mozilla Firefox</a><br/>

                   <a href="http://www.google.com/chrome/">Google Chrome</a><br/>

                   <a href="http://www.apple.com/safari/download/">Apple Safari</a><br/>

                   <a href="http://www.google.com/chromeframe">Google Chrome Frame for Internet Explorer</a><br/>

              </canvas>

        </div>

         

         <div id="no-chrome" style="display:none">

              YOUR BROWSER IS NOT CHROME

         </div>

         <!-- Pages load faster with scripts at the bottom -->

         

         <!-- Construct 2 exported games require jQuery. To save bandwidth, by default

         this is set to grab it off the Google content delivery network (CDN). Fall back to local if not available. -->

         <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script>

         <script>window.jQuery || document.write("<script src='jquery-1.6.3.min.js'>\x3C/script>")</script>

         

        <!-- The runtime script. You can rename it, but don't forget to rename the reference here as well.

        This file will have been minified and obfuscated if you enabled "Minify script" during export. -->

         <script src="c2runtime.js"></script>

        <script>

            // Start the Construct 2 project running on window load.

            jQuery(document).ready(function ()

            {

                   var userAgent = navigator.userAgent.toLowerCase();

                   $.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase());

                if($.browser.chrome){

                        // Create new runtime using the c2canvas

                        cr.createRuntime("c2canvas");

                      //INITIALIZE CONSTRUCT

                   } else {

                      $("#no-chrome").show();

                      $("#canvas-container").hide();

                   }

            });

        </script>

    </body>

    </html>

  • Yes it works. Thanks.

    And where to add the reference to a picture about the prevention?

  • Put your html here:

    <div id="no-chrome" style="display:none">

              YOUR BROWSER IS NOT CHROME

         </div>

  • I am grateful to you for the help. Thanks.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The HTML content shown between the <canvas> and </canvas> tags in the exported page is shown if the browser doesn't support canvas. You should just use that, it's much easier!

  • why only chrome? I use only Opera & Firefox...

  • In <canvas> the content is displayed when the browser doesn't support HTML5, but we a script block opening <c2canvas> from for it it empty. How in <canvas> to insert the image?

    http://dl.dropbox.com/u/50657347/Image98.png

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)