473,698 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IE 6, javascript:void (0) stops the webpage loading

Hi!
I m facing a problem with 'javascript:voi d(0)'

Software Environ:-
IE: 6.0.2600.0000
OS: Windows 2000 Professional with Service Pack 4

Problem:-
I have a webpage with several links (<A> tags), now i have added
onClick and blocked HREF using 'javascript:voi d(0)' as below:-

<a href="javascrip t:void(0)"
onClick="some_f unction('pagena me')">Text</a>

Here 'some_function' is opening the 'pagename' in a new customised
window.

This page also contains a few images weighing 50kb. Now if I click the
<a> links before the images are loaded fully, following happens (on my
pc it works well but it happens when i test it online):-

1. The new page opens in a window as required
2. But the page loading is ABORTED and the images are not loaded.

More:-
This is not happening in FF 1.0.7

Need Help!

Dec 29 '05 #1
13 13670
Jitendra wrote:
Hi!
I m facing a problem with 'javascript:voi d(0)'

Software Environ:-
IE: 6.0.2600.0000
OS: Windows 2000 Professional with Service Pack 4

Problem:-
I have a webpage with several links (<A> tags), now i have added
onClick and blocked HREF using 'javascript:voi d(0)' as below:-

<a href="javascrip t:void(0)"
onClick="some_f unction('pagena me')">Text</a>
This is a known feature of IE and why the use of the javascript
pseudo-protocol for the value of HREF attributes is actively discouraged.

<URL:
http://groups.google.com/group/comp....07ad60e4d8fe1f


Use something like:

<a href="serverFun ction.html"
onClick="some_f unction('pagena me');return false;">Text</a>
Where the href attribute allows the function to be performed on the
server and the return false stops it being followed where JavaScript
is enabled.
[...]
--
Rob
Dec 29 '05 #2

RobG napisal(a):
Jitendra wrote:
<a href="javascrip t:void(0)"
onClick="some_f unction('pagena me')">Text</a>

Use something like:

<a href="serverFun ction.html"
onClick="some_f unction('pagena me');return false;">Text</a>

Where the href attribute allows the function to be performed on the
server and the return false stops it being followed where JavaScript
is enabled.


And if you don't have some server-based alternative, use something
like:
<a href="#" onClick="some_f unction('pagena me');return false;">Text</a>
and if the user has javascript turned off, the link will still have no
effect except of appending "#" to the URL. Of course if you want some
CGI fallback for js fault, then keep the 'backup link', but if it's to
be a page that says "Sorry, you need Javascript", better if it does
nothing instead.

Dec 29 '05 #3
bw****@gmail.co m wrote:
And if you don't have some server-based alternative, use something
like:
<a href="#" onClick="some_f unction('pagena me');return false;">Text</a>
and if the user has javascript turned off, the link will still have no
effect except of appending "#" to the URL.
.... and making the user wonder why the link didn't work (probably after they
wait for a couple of minutes for the "new page" to load).

.... and shoving the user back up to the top of the page if they had scrolled
down to get to the link.
Of course if you want some
CGI fallback for js fault, then keep the 'backup link', but if it's to
be a page that says "Sorry, you need Javascript", better if it does
nothing instead.


I disagree. When the user expects something to happen, the system shouldn't
silently fail on them. A server side alternative is best, but an error
message beats nothing at all.

Another option is to generate the link with JavaScript in the first place -
after testing that all the needed features are available.

--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Dec 29 '05 #4
Thanks all for a very prompt reply!

: (

1. Actually i m not worried about javascript blocking as Javascript is
a prerequieist for my application. So the user is aware of this.
2. I cant use '#' as IE will treat it as a page location and scroll up
the page to the top.
3. i am not using any server side at this level as this only requires
to open another html page a new window....

: )
4. I can use 'href=somepage. html' (but i m doubtful of any flickering
as we are calling 2 pages - 1 on href and 2 onClick, pls correct me)

i ll let u know abt this....thnx again

i have to dliver the app day after....hope it will work

c ya

Dec 29 '05 #5
jitendramr wrote:
Thanks all for a very prompt reply!

: (

1. Actually i m not worried about javascript blocking as Javascript is
a prerequieist for my application. So the user is aware of this.
2. I cant use '#' as IE will treat it as a page location and scroll up
the page to the top.
Hence the suggestion to use - return false - in the onclick, it will
stop the browser following the link (i.e. in this case, going to the
top of the page).

3. i am not using any server side at this level as this only requires
to open another html page a new window....

: )
4. I can use 'href=somepage. html' (but i m doubtful of any flickering
as we are calling 2 pages - 1 on href and 2 onClick, pls correct me)


If you use return false the HREF will not be followed regardless of
what you put in there. Just don't use javascript:void ().
[...]
--
Rob
Dec 29 '05 #6
I see...i ll give a try...

Thanks dear

Dec 29 '05 #7
RobG said the following on 12/29/2005 7:58 AM:
jitendramr wrote:
Thanks all for a very prompt reply!

: (

1. Actually i m not worried about javascript blocking as Javascript is
a prerequieist for my application. So the user is aware of this.
2. I cant use '#' as IE will treat it as a page location and scroll up
the page to the top.

Hence the suggestion to use - return false - in the onclick, it will
stop the browser following the link (i.e. in this case, going to the top
of the page).

3. i am not using any server side at this level as this only requires
to open another html page a new window....

: )
4. I can use 'href=somepage. html' (but i m doubtful of any flickering
as we are calling 2 pages - 1 on href and 2 onClick, pls correct me)

If you use return false the HREF will not be followed regardless of what
you put in there. Just don't use javascript:void ().


<a href="somePage. html" onclick="return openWindow('thi s.href')">

function openWindow(newU RL){
....
return false
}

Then, if anything in the function errors, the normal navigation takes
place. It is even a good practice when creating links with script. It
allows *something* to happen even when something breaks.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 29 '05 #8
thnx randy

Dec 30 '05 #9
David Dorward <do*****@yahoo. com> wrote:
I disagree. When the user expects something to happen, the system shouldn't
silently fail on them. A server side alternative is best, but an error
message beats nothing at all.


That's my personal opinion as well, but it seems that there is a trend
(if Safari and my copy of the IE 7 beta indeed constitute a "trend")
toward hiding script errors from users not actively searching for
them.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cybers pace.org | don't, I need to know. Flames welcome.
Dec 30 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
650
by: jitendramr | last post by:
Hi! I m facing a problem with 'javascript:void(0)' Software Environ:- IE: 6.0.2600.0000 OS: Windows 2000 Professional with Service Pack 4 Problem:- I have a webpage with several links (<A> tags), now i have added onClick and blocked HREF using 'javascript:void(0)' as below:-
4
3881
by: Doug van Vianen | last post by:
Hi, I am using Visual Basic 6 to generate web pages that can be used by the members of our seniors' computer club to create e-cards that include their own pictures. I wish to include background music. The music plays okay until the viewer clicks to cause some JavaScript code to execute. When the JavaScript code runs it stops the music even though the coding is just used to resize pictures and divs on the page (viz, it is not supposed...
6
2768
by: Venkatesh | last post by:
Hello All, I have couple of doubts regarding the concept of on-demand javascript loading using javascript code. I could see on the net different techniques for achieving this - techniques like: 1. document.write("<script src= language='JavaScript'></script>); 2. sc = document.createElement("<script>"); sc.setAttribute("src", ); and append this to the head
3
2682
dmjpro
by: dmjpro | last post by:
plz explain in details about javascript:void(0) any help is most welcome ...............
3
3492
by: buhailiang | last post by:
I've a 'TEST' link on page, which has href='javascript: void(0)', and a big iframe page. When I load the page, window.onload event is triggered after the big iframe page loaded, If I click the 'TEST' link before the window.onload execute, the window.onload will never execute in IE 6.0. <html> <body>
4
2695
by: clutz | last post by:
I recently have been unable to access video on my pc due to a javascript void message. I have spoken to techs and we went through the same things over and over. Making sure javascipt is enable, upgrading my browser to IE7, etc.,etc.; even removing my spyware program, Spybot. I have XP SP2, and really don't want to spends lots of cash fixing this. Can anyone help?
1
1693
by: 5bfree | last post by:
Gateway, Windows XP, IE7. How do I fix a javascript void error? Already tried the easy stuff; make sure its enabled, restart, etc. Thanks.
13
37898
eragon
by: eragon | last post by:
JavaScript Loading Mask Requirements: Little knowledge in JavaScript and some HTML. JavaScript enabled browser. Applications: Useful for all those pages that load slow, and in sections, so instead of watching the page load in sections. Put this in your <head>: <script type="text/javascript"> function overlay() { elem = document.getElementById("overlay");
3
1927
by: leehanson | last post by:
I have a timer function that displays to the user the current number of seconds left for the current question. It all works fine, however when the timer is ticking down, and the user starts to drag the window, it stops. It seems to entirely stop javascript from executing. This issue is not seen in IE. Can anyone explain why Firefox stops executing JS when the window is moved/mouse is down over the blue top of the firefox window. I pray...
0
9170
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9031
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8904
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8876
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7741
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.