Support » Fixing WordPress » Canvas/JS in Pages/Posts

  • 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!

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can do this with a Page Template

    Thread Starter Taschmahal

    (@taschmahal)

    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?

    Thread Starter Taschmahal

    (@taschmahal)

    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>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Canvas/JS in Pages/Posts’ is closed to new replies.