Execute Javascript Question

0 favourites
  • 3 posts
  • With (what I am sure are well-founded) warnings about using Execute Javascript in Construct 2, I'm hoping that someone can provide me with either assurances or further warnings regarding the following instance of Execute Javascript:

       Execute javascript "javascript:window.print();"

    Do you think this is something that could cause security issues, etc... ? If so, have you found any alternate ways to achieve a window print?

    FYI, I'm not just asking off the top of my head. I tried to be a responsible community member by searching the manual, tutorials and forums but failed to find a solution.

  • You don't need the "javascript:" part at the front. Your game will also crash on non-browser platforms like CocoonJS that don't provide a window.print function, so you should check the function is there before you use it, as in: "if (window.print) window.print();"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you so much for your reply and tips Ashley (and for correcting my javascript) <img src="smileys/smiley9.gif" border="0" align="middle" />

    I'm going to be publishing this only for browsers for the time-being. My primary concern is to ensure there will be no security issues. Of course functionality is pretty darned important too ;)

    This will be my first published project made with Construct 2, so... fingers crossed!

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