开发者

Turn off JavaScript notifications in IE9 and FireFox4

开发者 https://www.devze.com 2023-02-26 05:47 出处:网络
In web development, JavaScript is often executed when clicking on elements. In both Internet Explorer 9 and FireFox 4 a little message pops up in the bottom left hand corner with the JavaScript funct

In web development, JavaScript is often executed when clicking on elements.

In both Internet Explorer 9 and FireFox 4 a little message pops up in the bottom left hand corner with the JavaScript function will be executed by clicking on elements these elements.

ASP.NET makes use of the JavaScript __doPostback(...ugly parameter names..) on almost every element that sends a request to the server. This JavaScript is automatically added to the HTML elements that are generated by the ASP.NET controls and I have no way to circumvent this.

For example, an ASP.NET DropDownList is rendered as an HTML Select element and the __doPostBack() method is added to it so that whenever the user selects a new element, the server can process this action.

The __doPostaback() method is embedded into many of the ASP.NET controls and there is no easy way to change this.

One of my end users commented that this new feature makes it feel as if they are in "Debug-mode"....

So, my question is: how do I either make this popup show something user friendly...or is there a way to tell the browser (via HTML)开发者_开发技巧 not to display this nastiness?

Thanks!

-Frinny


Why don't you make the href of the link a hashtag and attach the actual action via JavaScript:

HTML
<a id="foo" href="#foo">Foo</a>

JS
var foo = document.getElementById('foo');
foo.onclick = function(e){
  //script foo!
  return false;
};

Your location will still be #foo to look nice, but the actual action will be in the foo.onclick function.

Alternatively you can specify the event inline (<a href="foo" onclick="return foo();">Foo</a>), but I try to keep a clear MVC separation with HTML, CSS, & JS.

Using a hashtag also gives you the ability to listen for hash-change events or check the hash tag onload so that a user can still middle-click a link and have it work correctly in a new tab.


To my knowledge there isn't a way to make it not display, as that is part of the browser and not the page.

What I would do is create javascript functions at the top of the page with user readable names that contain the other functions inside.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号