Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jared 2 posts 72 karma points
    Feb 07, 2019 @ 13:11
    Jared
    0

    Best way to add text/javascript block and iFrame to a site?

    Hi everyone,

    New to using Umbraco and would really appreciate some advice regarding embedding iFrames to a site.

    I have the following to add to the < head >

    < script> src="https://cezanneondemand.interweb.it/integration/announces_js.php?&h=400&w=800*lang=en&k=f9e0bec95db28fc=companyname&d=website&view=list" type="text/javascript"> < / script >

    Then this following to add to the < body >

    < div id-"inrecruiting_announces">< / div>

    inRecruiting("inrecruiting_announces").inrIframe{{
        bgColor:"FFFFFF",
        bgRowVacancy:"FDFDFD",
        SeparatoColor: "AAAAAA",
        filterColor: "494444",
        jobTitleActiveColor:"888888",
        }}
    

    Based on what I've researched so far I assume I need to add the < head > script in the relevant page template under settings, then create a partial view macro file for the body script to then reference as a macro. However I'm a bit lost in terms of how to format the partial view macro file or if there is a better way of doing it?

    Thanks in advance, if any further detail helps just let me know.

  • louisjrdev 107 posts 344 karma points c-trib
    Feb 07, 2019 @ 17:13
    louisjrdev
    0

    I would create 2 fields on your doctypes both textareas, call one Head Scripts and one Body Scripts and then in your master template you can call each of them like so:

    <head>    
        @Html.Raw(Model.Content.GetPropertyValue<string>("headScripts"))
    </head>
    <body>
        @Html.Raw(Model.Content.GetPropertyValue<string>("bodyScripts"))
    </body>
    

    you can then add your scripts (in html script tags) into these fields in the backoffice and they will display on the site (dont forget to null check)

  • Jared 2 posts 72 karma points
    Feb 08, 2019 @ 09:03
    Jared
    0

    Hi Louis,

    Thanks for your response, really appreciate it. I've added the script with the method you described, however upon previewing the changes I'm receiving the following error message where I expect to see the script result:

    "Warning: vacancy not found"

    Could you advise what could be causing that please?

    Screenshot

  • louisjrdev 107 posts 344 karma points c-trib
    Feb 08, 2019 @ 09:10
    louisjrdev
    0

    looks unrelated, nothing with the code i specified would cause that error, assuming a normal umbraco setup

Please Sign in or register to post replies

Write your reply to:

Draft