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

Forums / General Discussions / URL to link JS files shows 404 error

URL to link JS files shows 404 error

5 posts, 0 answered
  1. Venkatesh Alagu
    Venkatesh Alagu avatar
    42 posts
    Registered:
    22 Nov 2009
    04 Oct 2011
    Link to this post
    hi,

    I m new to sitefinity 4.2. i build a master template from my html template. i lnked css and js files as per structure. but these files are not loading to my template . getting 404 error

    <link href="App_Data/Sitefinity/WebsiteTemplates/ePINS/App_Master/global/main.css" rel="stylesheet" media="screen" type="text/css" />
    <script type="text/javascript" src="scripts/rollover.js"></script>
    <script type="text/javascript" src="scripts/jquery-1.4.2.min.js"></script>

    can u pls help me to link my css & Js file as per their root directory??

    Thanks & Regards,

    Venkatesh
  2. Victor Velev
    Victor Velev avatar
    1345 posts
    Registered:
    06 Jul 2015
    04 Oct 2011
    Link to this post
    Hi Venkatesh,

    If you need to use Jquery ( we have it included in Sitefinity ) for your masterpage you can use it just by adding the following code:

    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
       
    // your logic here
       
    <sf:ResourceLinks id="resourcesLinks" runat="server">
    <sf:ResourceFileJavaScriptLibrary="JQuery"/>
    </sf:ResourceLinks>

    Otherwise the bellow structure applies for other js files.

    <sf:ResourceFileName="JS/myfile.js"/>
    Kind regards,
    Victor Velev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Venkatesh Alagu
    Venkatesh Alagu avatar
    42 posts
    Registered:
    22 Nov 2009
    05 Oct 2011
    Link to this post
    Thanks for ur reply.

    When i add ur code in the body or head i m getting ResourceLink error.

    i added like this

    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sf" %>
        
    <sf:ResourceLinks id="resourcesLinks" runat="server">
    <sf:ResourceFileJavaScriptLibrary="JQuery"/>
    <sf:ResourceFileName="JS/rollover.js"/>
    </sf:ResourceLinks>

    For time being i m using hand coded URL to get my javascript file. i m very new to this sitefinity 4.2. can u please help to solve this issue?


    Thanks & Regards,

    Venkatesh
  4. Victor Velev
    Victor Velev avatar
    1345 posts
    Registered:
    06 Jul 2015
    06 Oct 2011
    Link to this post
    Hello Venkatesh Alagu,

    Please try the following:

    1. Register the script inside AssemblyInfo.cs class of the class library

     sample:

    [assembly: WebResource("TestControlProject.Resources.RotatorDesigner.js", "application/x-javascript")]

    2. The script file build action should be "EmbeddedResource"

    Regards,
    Victor Velev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Victor Velev
    Victor Velev avatar
    1345 posts
    Registered:
    06 Jul 2015
    06 Oct 2011
    Link to this post
    Hello Venkatesh Alagu,

    Just a quick follow up.

    Make sure to replace "TestControlProject.Resources.RotatorDesigner.js" with your path to the file.

    Regards,
    Victor Velev
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
5 posts, 0 answered