URL to link JS files shows 404 error

Posted by Community Admin on 03-Aug-2018 06:03

URL to link JS files shows 404 error

All Replies

Posted by Community Admin on 04-Oct-2011 00:00

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

Posted by Community Admin on 04-Oct-2011 00:00

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

Posted by Community Admin on 05-Oct-2011 00:00

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

Posted by Community Admin on 06-Oct-2011 00:00

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

Posted by Community Admin on 06-Oct-2011 00:00

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

This thread is closed