script src error

  • Thread starter Thread starter Joe
  • Start date Start date
Hi Joe,

As for the script returning by ASPX page, it should work correctly if the
page does write out the valid script text stream. How did you flush out the
script content via the page? here is a simple page code which I used to
test and it works well:

============================
protected void Page_Load(object sender, EventArgs e)
{
string siteName = Request.QueryString["siteName"];
string pageName = Request.QueryString["pageName"];

if( siteName == "MySite" && pageName == "index_html")
{
Response.ClearHeaders();
Response.ClearContent();
Response.ContentType = "text/javascript";
Response.WriteFile(Server.MapPath("~/scripts/myscript.js"));
Response.End();
}
//siteName=MySite&pageName=index_html
}
===========================

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.



--------------------
 
Hi Steven

The issue is not with the page being called but with the page calling it.
For some reason both IE and Firefox complain about the script.
The script block looks like this:
<script type="text/javascript"
src="http://track.oursite.com/trackstat.aspx?siteName=MySite&pageName=index_html">
</script>

Did you try something like this?


"Steven Cheng" said:
Hi Joe,

As for the script returning by ASPX page, it should work correctly if the
page does write out the valid script text stream. How did you flush out
the
script content via the page? here is a simple page code which I used to
test and it works well:

============================
protected void Page_Load(object sender, EventArgs e)
{
string siteName = Request.QueryString["siteName"];
string pageName = Request.QueryString["pageName"];

if( siteName == "MySite" && pageName == "index_html")
{
Response.ClearHeaders();
Response.ClearContent();
Response.ContentType = "text/javascript";
Response.WriteFile(Server.MapPath("~/scripts/myscript.js"));
Response.End();
}
//siteName=MySite&pageName=index_html
}
===========================

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.



--------------------
From: "Joe" <[email protected]>
Subject: script src error
Date: Thu, 20 Mar 2008 19:32:38 -0400
I have a script block in our page with the src set to something like this:
http://track.oursite.com/trackstat.aspx?siteName=MySite&pageName=index_html

The script seems to execute fine but IE shows a syntax error and FireFox
says invalid assignment left-hand side and points to the = in
pageName=index_html

Any idea what the problem could be?
 
There was a problem with the page being called. We put a Response.Write() in
that we forgot about and that was causing the error.
 
Thanks for your reply Joe,

So that's the additional "Response.Write" output make the page's client
html become invalid html document. Based on my local test, it also indicate
that the script reference code below is correct(should not cause client
browser error):

<script type="text/javascript"
src="http://track.oursite.com/trackstat.aspx?siteName=MySite&pageName=index_
html">
</script>

Anyway, I'm glad that you've resolved the problem.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 
Back
Top