473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

return false; stopped working in IE

3
I have this sample page that I made, and it works fine in FF and Safari. But does not work in IE (all versions). I am currently using IE8, but it did not work on IE7 either. However, it used to work on this computer. Also, it is not an IE8 bug because it works in IE8 on other computers. So, I know this is not a coding error, but how do I fix my IE so it starts to understand "return false" again? This also affects a whole lot of sites out there using return false. Because it simply does not work on ANY site in my IE.

It is very difficult testing new code (especially AJAX related things) when return false does not work and IE actually opens up all links that are clicked on even when its returned as false.

I desperately want to solve this issue, however, I'd like to do anything but re-install Vista.

[HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<body>
<a id="lnkClick" href="http://google.com/" onclick="return false;">Click this</a>
</body>
</html>[/HTML]
Nov 20 '08 #1
5 5379
acoder
16,027 Expert Mod 8TB
JavaScript might be disabled. Check that it's enabled in IE - see enabling JavaScript.
Nov 20 '08 #2
iGuff
3
JavaScript might be disabled. Check that it's enabled in IE - see enabling JavaScript.
JavaScript is enabled because all other JavaScript functions properly except that IE always follows links even if false is returned (like in this basic example). Plus, I've double checked that JavaScript is turned on. So basically IE runs the JS code associated with the onclick event, and then it follows the link. So, if you want buttons or links to do certain AJAX things, itd do them, but then it'd follow the link. What's the point of it loading things AJAX-style if in the end it follows the link anyways.
Nov 20 '08 #3
acoder
16,027 Expert Mod 8TB
You could try the stopPropagation()/preventDefault (standard) methods or the event.cancelBubble property for IE. If that doesn't work, IE has a returnValue property for its global event object which you can set to false.

Two more quick things. The above posted code does work normally, so there's something wrong in your IE. Try removing any addons/toolbars, etc. added to the browser. Finally, you can always use a button instead of links.
Nov 21 '08 #4
iGuff
3
You could try the stopPropagation()/preventDefault (standard) methods or the event.cancelBubble property for IE. If that doesn't work, IE has a returnValue property for its global event object which you can set to false.

Two more quick things. The above posted code does work normally, so there's something wrong in your IE. Try removing any addons/toolbars, etc. added to the browser. Finally, you can always use a button instead of links.
I dont have any toolbars installed, but there were some browser helper objects installed by a couple of applications, and when I disabled "McAfee Phishing Filter" and "scriptproxy" (both by McAfee), the return false started working again in IE. Yay. Thanks a bunch! I didnt even think of looking into these kinds of stuff since I have no toolbars/extensions installed. So if someone else has the same problem as I did, try disabling anything McAfee or anti-virus related for the browser.
Nov 21 '08 #5
acoder
16,027 Expert Mod 8TB
Excellent! Glad you got it working.
Nov 23 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

94
by: John Bailo | last post by:
The c# *return* statement has been bothering me the past few months. I don't like the fact that you can have different code paths in a method and have multiple return statements. To me, it...
6
by: Alan Silver | last post by:
Hello, I have an ASP that takes a connection string and SQL statement in the querystring and is supposed to return the XML representation of the recordset to the Response stream (don't worry,...
2
by: Dag Sunde | last post by:
I have the following code fragment in one of my pages: if (typeof document.getElementById('myApplet').getTableAsSDV != 'undefined') { rowBuffer =...
1
by: philjhanna | last post by:
Hi I'm having a problem applying return false to a div via addEventListener. I'm adding this so that I can drag (click-hold-move) over an image. (Its so that I can add zooming to the image)...
10
by: Mark Jerde | last post by:
I'm trying to learn the very basics of using an unmanaged C++ DLL from C#. This morning I thought I was getting somewhere, successfully getting back the correct answers to a C++ " int SumArray(int...
2
by: pmb | last post by:
I've been experimenting with ASP.NET pages for some weeks, but suddenly it stopped working! When I try to load any script from my browser, like this: http://localhost/myfolder/myscript.aspx, I get...
4
by: =?Utf-8?B?c3Jpbml2YXM=?= | last post by:
Hi, I'm having an ASP.net page with a dropdown list box named ddlStatus, a button and editable gridview. I wrote a small javascript function "OnSave()" and called it on the event...
1
by: Kenneth Baltrinic | last post by:
I am having a very odd problem. On a page that was working until very recently we are now encountering the following situation: The page is a very basic fill in the blank form used for changing...
1
by: Kenneth Baltrinic | last post by:
I am having a very odd problem. On a page that was working until very recently we are now encountering the following situation: The page is a very basic fill in the blank form used for changing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.