Copied to clipboard

Flag this post as spam?

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


  • Andrew Wenzel 1 post 71 karma points
    Sep 16, 2021 @ 14:41
    Andrew Wenzel
    0

    How are custom JavaScript codes added to the website's source code in Umbraco 7.

    How are custom JavaScript codes added to the website's source code in Umbraco 7. Please note that I am a content producer and not a coder. I do however know my way round the back office quite well. I have a third party JavaScript code which I would like to add to our website but don't know how to implement it. Also is there a way of adding to every page on the website with just one insertion please. i.e. not having to do each page individually? Some screen shots of how to do this would be very helpful. Many thanks Andrew

  • Phung Dao 22 posts 102 karma points
    Sep 21, 2021 @ 00:13
    Phung Dao
    0

    Javascript can be added either to the cshtml files themselves

    or in your rich text editor box. On the top-left, there should be a <> icon for source code. Click there and add code that you want.

    Since you want it on every page, you would add the javascript to your Master template file.


    two methods

    using a file Put the script in a text file and save it as name-here.js and place it in the same folder as your site

    <script src="~/some-path/script-name.js"></script>
    

    in-line:

    <script type="text/javascript">
    your kewl javascript code goes here</script>
    
Please Sign in or register to post replies

Write your reply to:

Draft