You cannot directly access resources in a RESX file from javascript files.
However, you can create a partial view (in case you use MVC) from which you can access all of these resources. After that, you can enable this partial inside your pages.
For example, you can do a partial in which you will have:
<script> var Resources = { Name: '@Resources.tags.Name', Surname: '@Resources.tags.Surname', }; </script>
After that, you can include this page on the pages you need and access javascript from these resources using:
Resources.Name
If you are not using MVC, let me know to learn how to do this in ASP.NET.
If you have any doubts, please tell me.
For WebForms
If you use WebForms, you can use a user control in which you will configure javascript for input on the page.
Then include this user control on your page (preferably a wizard to make it accessible across your entire site), and you can access it.
The user control will look like this:
public partial class resources : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { LiteralControl jsResource = new LiteralControl(); jsResource.Text = "<script type=\"text/javascript\">"; jsResource.Text += "var Resources = {"; jsResource.Text += "Name: '" + Resources.Resource.Name + "',"; jsResource.Text += "Surname: '" + Resources.Resource.Surname + "',"; jsResource.Text += "};"; jsResource.Text += "</script>"; Page.Header.Controls.Add(jsResource); } }
Then you would include this control on your page:
<uc1:resources runat="server" ID="resources" />
And you can just access your javascript by doing this:
<script> alert(Resources.Name); alert(Resources.Surname); </script>