Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Inserting into HTML head?

edited December 2015 in Help! with 1.x
I've got some code that should go in the header to make the exported game work a little nicer as a web app for iOS:
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
Is there currently a way to include this somewhere in my .tws and have it auto-insert at build? Right now I'm just going into the built file and inserting it afterward, which is fine, but adds another step and might be forgotten.


  • I believe the simple answer is No.

    The Twine 1 built process uses Text Substitution to replace Markers in the header.html file with information stored in the TWS and there are no relevant Makers in the head element.
    Because the meta elements in the head section are generally parsed prior to the execution of Javascript techniques like $('head').append('META TAG') probably won't work for you like they would if you wanted to add script/style elements.

    But someone else may know of a way, or maybe Safari on iOS delays the reading of those meta items to after the execution of the Javascript.
  • edited December 2015
    Aha! The jQuery method actually totally works.

    For posterity, what I'm doing is putting all my header stuff in a passage for easier editing:
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <link rel="apple-touch-icon" href="assets/touch-icon-iphone.png">
    <link rel="apple-touch-icon" sizes="76x76" href="assets/touch-icon-ipad.png">
    <link rel="apple-touch-icon" sizes="120x120" href="assets/touch-icon-iphone-retina.png">
    <link rel="apple-touch-icon" sizes="152x152" href="assets/touch-icon-ipad-retina.png">
    ...and loading that separately:
    ::headAppender [script]
  • edited January 2016
    Is there any way to make that work in Harlowe, since the Tale object is a SugarCube thing? (I am using Twine 2/Harlowe)
  • Harlow does not current have a documented Javascript API for Authors to use which means that any solution using undocumented features may stop working without any notice.

    That being said currently the equivalent of tale.get("headAppend").text is:
  • Well... Sorry but I don't catch how to insert my META in Harlowe / Twine 2

    Thank you !
  • please help me :-)
Sign In or Register to comment.