WordPress.org

Ready to get started?Download WordPress

Forums

Canvas/JS in Pages/Posts (4 posts)

  1. Taschmahal
    Member
    Posted 1 year ago #

    Hi!

    I'm a bit confused. It seems like wordpress can't handle canvas/ JS ins posts and pages. I already tried the following with different themes:

    Link1 Link2 Link3.

    It's a pity that the pages and post areas aren't "blank pages" where you could insert all kind of code.

    Has anyone had this problem before and could help me out? I would be pleased!

  2. Pioneer Valley Web Design
    Member
    Posted 1 year ago #

    You can do this with a Page Template

  3. Taschmahal
    Member
    Posted 1 year ago #

    Hi!

    I tried your solution, but there are two problems:

    First, the JS should load in the <header>.

    The second problem: canvas uses <body onload....>. The onload must be in the body-tag. So honestly no solution.

    But thanks nevertheless.

    Any other solutions?

  4. Taschmahal
    Member
    Posted 1 year ago #

    Hi!

    Got the solution!

    Load the JS in your post like:

    <script type="text/javascript" src="http://domain.com/js.js"></script>

    And load the funciotn inside the JS:

    window.onload = function doCanvasblabla()

    Then Canvas does the rest!

    <canvas width="700" height="500" id="canvas">Your browser does not support html5 canvas.</canvas>

Topic Closed

This topic has been closed to new replies.

About this Topic