Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9238331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:44:13+00:00 2026-06-18T07:44:13+00:00

HTML5 canvas (only using the drawImage function) is not showing up on mobile devices,

  • 0

HTML5 canvas (only using the drawImage function) is not showing up on mobile devices, but is on my laptop.

You can see here : mmhudson.com/index.html (reload once)

I get no errors or anything, but it doesn’t display in chrome on iOS or the default browser on android..

EDIT:

This problem only occurs when the following meta tag is included in the document:

<meta name="viewport" content="width=device-width, initial-scale=1"></meta>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:44:14+00:00Added an answer on June 18, 2026 at 7:44 am

    Your init() function is called by imgLoad(), but you’re loading images only when the window width is greater than or equal to 480px:

            window.onload = function(){
                s.dL = true;
                s.width = window.innerWidth;
                s.height = window.innerHeight;
    
    
                if(s.width < 320){
                    //too small
                }
                else if(s.width >= 320 && s.width < 480){
                    s.scWidth = 296;
    
                }
                else{
                    s.scWidth = 456;
                    b_border.src = "res/480/b_border.png";
                    r_border.src = "res/480/r_border.png";
                    l_border.src = "res/480/l_border.png";
                    t_border.src = "res/480/t_border.png";
                    br_corner.src = "res/480/br_corner.png";
                    tr_corner.src = "res/480/tr_corner.png";
                    bl_corner.src = "res/480/bl_corner.png";
                    tl_corner.src = "res/480/tl_corner.png";
                    h_wall.src = "res/480/h_wall.png";
                    v_wall.src = "res/480/v_wall.png";
                    box.src = "res/480/box.png";
                    crosshair.src = "res/480/crosshair.png";
                    player1.src = "res/480/player1.png";
                    player2.src = "res/480/player2.png";
                }
            }
    

    When you omit the meta viewport tag, the browser assumes a page / window width of 980px, and so your code runs normally.

    When you include a meta viewport tag with width=device-width, the browser sets the page / window width to the width of the screen (e.g. 320px on iPhone), and so imgLoad() and init() is never called.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to make something like live type using html5 canvas, but I can't
I have external html5 canvas that you can paint on some lines using your
I'm trying to resize a HTML5 canvas element using jQuery. (NOTICE: Not the objects
How can I go about cropping a HTML canvas around only it's content? I
Some of the HTML5 canvas demos are very impressive, but I'm a bit confused.
I am developing an HTML5 canvas based mini-game and I can't seem to organize
Working on a small game using an HTML5 canvas, and javascript. And it's working
I have a HTML5-canvas and write text with context.fillText(...); using a @font-face-font. Displaying the
I am making a game using html canvas. Here is my progress: http://db.tt/ei3LlR (use
I would like to distort Youtube videos using html5 canvas. I know how it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.