Connecting Tech Pros Worldwide Help | Site Map

<noscript> not working

Member
 
Join Date: Oct 2007
Posts: 70
#1: Jun 4 '08
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <script language="JavaScript" type="text/javascript">
  5.  
  6. </script>
  7. <noscript>
  8.      <b>Please</b> Try this page for browsers that can not handle SCRIPTing.
  9.      <a href="EnableJavascript.aspx">click here</a>
  10. </noscript>
  11.  
  12. <html xmlns="http://www.w3.org/1999/xhtml" >
  13. <head runat="server">
  14.     <title>Untitled Page</title>
  15.  
  16. </head>
  17. <body>
  18.     <form id="form1" runat="server">
  19.     <div>
  20.      hello there
  21.     </div>
  22.     </form>
  23. </body>
  24. </html>
  25.  
Can someone tell me why the above code is not working.
i am trying to test the <noscript> tag.
I am only seeing hello There, but i am supposed to also see the link click here.

I disabled scripting in the browser

please help
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Jun 4 '08

re: <noscript> not working


The <noscript> tag should be in the body.

PS. moved to the HTML/CSS forum.
Member
 
Join Date: Oct 2007
Posts: 70
#3: Jun 4 '08

re: <noscript> not working


thanks

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#"  %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" >
  4.  
  5. <body>
  6.  
  7. <noscript>No JavaScript support!</noscript>
  8.  
  9. <p>A browser that does not support JavaScript will show the text in the noscript element.</p>
  10.  
  11. </body>
  12.  
  13. </html>
  14.  
  15.  
i did the above code and it works as a stand alone page. however, my site uses masterpages so i dont know how to incorporate the <noscript> tag into my site since the <body> tag is in teh ,masterpage

any suggestions
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: Jun 4 '08

re: <noscript> not working


That would be a .NET problem. I don't see why it can't be added to the content page. If that doesn't solve it, ask in the .NET forum.
Member
 
Join Date: Jun 2007
Posts: 111
#5: Jun 6 '08

re: <noscript> not working


in which case, rather than use the noscript tag.

put the message in a div, and make the div always visable.

If you have a generic master footer template for your webpages.
You can then use javascript to hide this div. If the user has no javascript then the javascript code will not execute and therefore, will not hide the div containing your message.
Reply