Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript in serverside?

Status
Not open for further replies.

Sidro

MIS
Sep 28, 2002
197
US
Hi,
Javascripts are usually coded in the client side portion. Thus when users clicks on the view source button, they can see the scripts and other codes for that page. However, they wont be able to see the codes coded for the serverside portion. My question is can we put the javascript in the serverside portion so that it doesnt appear on the clientside when they click on the view source button? Thankx in advance.
 
as far as i know ., NO,
javascript is executed in a browser env. so even if you use registerjavascript/client script method in asp.net u can still see the code reproduced in browser.
hope this helps
 
Hi,
thanks for your input. What about vbscripts? Will that work since asp uses vb? thankx again.
 
Actually, I have some javascript written in my code-behind and when you view the source, you don't see it.
Code:
Private Sub btnSearchIt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearchIt.Click
   If (UCase(blnFlag) = "FALSE") Then
Response.Write(&quot;<script language='javascript'>parent.Data.location='results.aspx';</script>&quot;)
 Else
                Response.Write(&quot;<script language='javascript'>alert('Please enter search criteria in text area');</script>&quot;)
            End If
 End Sub

 
ksbrace-

You may not see the source on page load, but have you checked the source after the page posts back (after you click the button)?.

Client side script must be visible to the browser to function, therefore, it will be visible from &quot;view source&quot;.

-----------------------------------------------
&quot;The night sky over the planet Krikkit is the least interesting sight in the entire universe.&quot;
-Hitch Hiker's Guide To The Galaxy
 
very smart.!!
it writes to the browser only when the condition is true. -right??
i like that.
 
If you click on View/Source now, you probably will get viewthread[1] and a blank Notepad... I see that this is a cfm file but wondered if this is possible in aspx ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top