1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Load javascripts on Master Page

Load javascripts on Master Page

5 posts, 0 answered
  1. Thiago Borda
    Thiago Borda avatar
    5 posts
    Registered:
    17 Mar 2010
    06 May 2010
    Link to this post
    Hi!
    I'm trying to load javascripts on my Master Page, but every solution i find doesn't work fully on all pages...
    Someone knows what is the right way to do it?

    Thanks,
    Thiago Borda
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    06 May 2010
    Link to this post
    Hi Thiago Borda,

    Try using JsFileLink or use HTML <script> tag (<script type="text/javascript" src="myscripts.js"></script>)

    All the best,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Renata Bauerle
    Renata Bauerle avatar
    2 posts
    Registered:
    07 May 2010
    07 May 2010
    Link to this post
    Hi!

    I work with Thiago and the problem we actually have is a little wider then this.
    We could get the js scripts to work but only when using a relative path to the js file.
    What we need is to use the absolute path. We usually use a c# variable containing the our root folder to form the path on the master page. We realized that we can use " ~/ " to insert css files, but doesn't work for js.
    Another detail is that we have to have the js inserted on the head tag of the master page.

    Thanks, Renata Bäuerle
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    07 May 2010
    Link to this post
    Hello Renata Bauerle,

    The JsFileLink control can use "~/" to prefix the file location for the JS.

    Sincerely yours,
    Radoslav Georgiev
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Renata Bauerle
    Renata Bauerle avatar
    2 posts
    Registered:
    07 May 2010
    07 May 2010
    Link to this post
    Yes, we saw that. But we've tryied it and it works inside <body> but not inside <header>.
    Is there any other way?

    Thanks again.
Register for webinar
5 posts, 0 answered