Note that there are some explanatory texts on larger screens.

plurals
  1. POASP.net not generating javascript for some User Agents
    primarykey
    data
    text
    <p>********************Edit 2********************** I figured out the problem... But I don't like the implications. I was testing our iPhone targeted mobile application earlier and using a plugin to mask Firefox's User Agent String as an iPhone.</p> <p>.Net was infact NOT generating the required code for post backs based on that piece of information alone.</p> <p>I do not like this however, because since the iPhone and other multimedia devices can interpret javascript, ASP.net is breaking any application that relies on server generated javascript to run.</p> <p>So, if the community will allow it... I'd like to change my official question to... Why will ASP.net not generate javascript for specific browsers and how can I turn this "feature" off.</p> <p>*************** End Edit 2 ***************</p> <p>I've got a weird problem. I copied some working code from my remote host to my computer at work. When I try to use the page I'm getting a javascript error </p> <pre><code>__doPostBack is not defined javascript:__doPostBack('ctl00$ContentPlaceHolder1$login','')()() </code></pre> <p>When I few the output page source, sure enough there is no server side generated javascript.</p> <p>I tried creating a simple page:</p> <pre><code>&lt;%@ Page Language="VB" AutoEventWireup="false" CodeFile="jsTest.aspx.vb" Inherits="_jsTest" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;asp:TextBox ID="tbTest" runat="server"&gt;&lt;/asp:TextBox&gt;&lt;br /&gt; &lt;asp:LinkButton ID="linkTest" runat="server"&gt;LinkButton&lt;/asp:LinkButton&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Codebehind:</p> <pre><code>Partial Class _jsTest Inherits System.Web.UI.Page Protected Sub linkTest_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles linkTest.Click Response.Write(tbTest.Text) End Sub End Class </code></pre> <p>Getting the same error.</p> <p>I've tried rebooting (hey, it works half the time), cleared out everything from App_Code, global.asax and web.config, added a textbox with autopostback=true... I'm out of ideas.</p> <p>Can anyone shed some light on what's happening here?</p> <p>**************More Information************** I just tried everything again in IE and it works as expected, the page source shows: </p> <pre><code>&lt;input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /&gt; &lt;input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /&gt; &lt;input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTkxNTA2MDE2NWRkxhZMwlMVwJprcVsvQLJLrTcgaSM=" /&gt; &lt;script type="text/javascript"&gt; //&lt;![CDATA[ var theForm = document.forms['form1']; if (!theForm) { theForm = document.form1; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]&gt; &lt;/script&gt; &lt;div&gt; &lt;input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAwK20LZAAuzRsusGAsz0+6YPxxO+Ewv1XsD5QKJiiprrGp+9a3Q=" /&gt; &lt;/div&gt; </code></pre> <p>While the source in Firefox only shows:</p> <pre><code>&lt;input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTkxNTA2MDE2NWRkxhZMwlMVwJprcVsvQLJLrTcgaSM=" /&gt; &lt;input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAwK20LZAAuzRsusGAsz0+6YPxxO+Ewv1XsD5QKJiiprrGp+9a3Q=" /&gt; </code></pre> <p>Saving the web pages to the desktop and opening in notepad reveals the same thing...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload