Re: It's trying to compile my JavaScript?
- From: Boris Yeltsin <borisy@xxxxxxxxxxxxx>
- Date: Wed, 23 Aug 2006 08:21:01 -0700
Hi again,
I'm running from the ASP.NET web server, so the root of the application
isn't the root of the server, e.g.:
http://localhost:4629/MyApplication/Home.aspx
So I can't just a straight / without rebasing it with the ~ (or another
method)
Thanks again for trying!
"Islamegy®" wrote:
i don't know why u don't add it dynamicly like you do in meta tags, so u.
don't have to change it the masterpage or forms, u can store it fixed in
web.config and add it from code behind.. easy huh?
you masy also right it like this
<script type="text/javascript" src="/scripts/master.js">
when use just "/" it's mean relative path from the root..
That's all i have..
"Boris Yeltsin" <borisy@xxxxxxxxxxxxx> wrote in message
news:3223AE33-CF95-40BB-9E24-8621858CA84A@xxxxxxxxxxxxxxxx
Hi Islamegy,
1) I'm not sure this will work for me. Doesn't the <base> tag need an
absolute URL? Even if it takes a relative URL, I'll still have to do
something to update the 'href' attribute on the fly to make it point to
the
right level, such as:
<base href="~/" runat="server" />
(which doesn't work - I tried it - but ASP.NET doesn't parse the ~)
2) I'm using code-behind solutions for adding dynamic meta-tags, but
that's
because they're dynamic. My JavaScript file is fixed, so I'd much prefer
the
reference in the markup and not in the code-behind :)
Thanks...
"Islamegy®" wrote:
Why you try to make it harder...
There is more simple solutions
1- add html <Base> tag after head..
2- make <head runat="server"> then u can access it from code and add
anything you want here is example
foreach (Control ctrl in this.Master.Controls)
{
if (ctrl is HtmlHead)
{
HtmlTitle title = new HtmlTitle();
title.Text = Convert.ToString(hdt.Rows[0]["Title"]);
Literal baseurl = new Literal();
baseurl.Text = string.Format("<base href=\"{0}\">",
ConfigurationManager.AppSettings.Get("BaseURL"));
HtmlMeta desc = new HtmlMeta();
desc.Name = "Description";
desc.Content =
Convert.ToString(hdt.Rows[0]["Description"]);
HtmlMeta keyword = new HtmlMeta();
keyword.Name = "Keyword";
keyword.Content =
Convert.ToString(hdt.Rows[0]["Keyword"]);
Literal additional = new Literal();
additional.Text =
Convert.ToString(hdt.Rows[0]["AdditinalHeadTags"]);
HtmlHead head = (HtmlHead)ctrl;
head.Controls.AddAt(0, title);
head.Controls.AddAt(1, baseurl);
head.Controls.AddAt(2, desc);
head.Controls.AddAt(3, keyword);
head.Controls.AddAt(4, additional);
}
"Boris Yeltsin" <borisy@xxxxxxxxxxxxx> wrote in message
news:B04EE22B-F242-42E8-B6A0-0455825DCAC0@xxxxxxxxxxxxxxxx
I use Master Pages, so I make use of URL rebasing through the ~
operator,
like this in the <head>:
<link runat="server" href="~/Root.master.css" media="screen"
rel="stylesheet" type="text/css" />
It works perfectly and the ~ gets converted by the server into the
correct
relative path. Great!
Now, I put this in the <head>:
<script type="text/javascript" src="~/Root.master.js"
runat="server"></script>
And everything screws up. It looks like it's trying to compile that .js
file
into the page as the CLR throws up syntax errors and compiler errors in
my
JavaScript (which is valid JavaScript).
What am I doing wrong? :(
- Follow-Ups:
- Re: It's trying to compile my JavaScript?
- From: Steven Cheng[MSFT]
- Re: It's trying to compile my JavaScript?
- References:
- Re: It's trying to compile my JavaScript?
- From: Islamegy®
- Re: It's trying to compile my JavaScript?
- From: Boris Yeltsin
- Re: It's trying to compile my JavaScript?
- From: Islamegy®
- Re: It's trying to compile my JavaScript?
- Prev by Date: Re: DOM CreateElement?
- Next by Date: Re: Configuring IE for debugging
- Previous by thread: Re: It's trying to compile my JavaScript?
- Next by thread: Re: It's trying to compile my JavaScript?
- Index(es):
Relevant Pages
|