469,271 Members | 997 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

Nullyfing events in a HTML

Hi All -

I am trying to do the following,
1. Get a piece of HTML from a db
2. Display it on my page
with a requirement - clicking on any links in that HTML should not take
me away from the page.

This does not only include links which are formed by <a>nchor tags, but
also other ways of doing it, like,
<span onClick='location.href="http://someurl"'> Blah blah..
</span>

In other words, all the events that can be raised by this piece of html
should be blocked.

Setting all the 'onClick's and 'href's to "#" or blank string is
probably a good idea to start with, but the list of all such possible
causes for an event to be raised, may not be very straightforward to
compile.

I was wondering if there could be any way to nullify/block the events
that can be raised by such a piece of HTML.

Thanks for your input

- Anand

Aug 11 '05 #1
5 1225

<c.**********@gmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
Hi All -

I am trying to do the following,
1. Get a piece of HTML from a db
2. Display it on my page
with a requirement - clicking on any links in that HTML should not take
me away from the page.

This does not only include links which are formed by <a>nchor tags, but
also other ways of doing it, like,
<span onClick='location.href="http://someurl"'> Blah blah..
</span>

In other words, all the events that can be raised by this piece of html
should be blocked.

Setting all the 'onClick's and 'href's to "#" or blank string is
probably a good idea to start with, but the list of all such possible
causes for an event to be raised, may not be very straightforward to
compile.

I was wondering if there could be any way to nullify/block the events
that can be raised by such a piece of HTML.

Thanks for your input

- Anand

have you considered doing it serverside?

Darren
Aug 11 '05 #2

Darren wrote:
have you considered doing it serverside?
You mean setting the href targets to blank values? Yeah, I did, but
even in that case, I will have to find out that part of the HTML which
is active. By active, I mean that HTML which is a hyperlink or a div
with a onMouseMove attribute attached to it or anything. Finding out
all such pieces will require a lot of work. Could there be a simpler
way?
Darren


Aug 11 '05 #3

<c.**********@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...

Darren wrote:
have you considered doing it serverside?
You mean setting the href targets to blank values?

No i mean parsing the page with a serverside script such as with php or
perl. there 'seems' to be a lot more you can do with these.
Yeah, I did, but
even in that case, I will have to find out that part of the HTML which
is active. By active, I mean that HTML which is a hyperlink or a div
with a onMouseMove attribute attached to it or anything. Finding out
all such pieces will require a lot of work. Could there be a simpler
way? Your looking at doing it from DOM? I would have thoought it would have been
easier parsing it as text then all you have to do is seek out "href" then
replace anything in quotes after that with #
Just my twopenneth worth. Darren

Aug 11 '05 #4
c. anandkumar wrote:
Hi All -

I am trying to do the following,
1. Get a piece of HTML from a db
2. Display it on my page
with a requirement - clicking on any links in that HTML should not take
me away from the page.

This does not only include links which are formed by <a>nchor tags, but
also other ways of doing it, like,
<span onClick='location.href="http://someurl"'> Blah blah..
</span>

In other words, all the events that can be raised by this piece of html
should be blocked.
I use "The Proxomitron" for that purpose, although, sadly, it is not being
supported anymore, due to the passing away of its creator.

Just in case, here's the link:
http://www.proxomitron.info/

Setting all the 'onClick's and 'href's to "#" or blank string is
probably a good idea to start with, but the list of all such possible
causes for an event to be raised, may not be very straightforward to
compile.

I was wondering if there could be any way to nullify/block the events
that can be raised by such a piece of HTML.


The filter can be configured in a very colorful variety for all tastes...

HTH
Aug 12 '05 #5
VK

c.**********@gmail.com wrote:
Hi All -

I am trying to do the following,
1. Get a piece of HTML from a db
2. Display it on my page
with a requirement - clicking on any links in that HTML should not take
me away from the page.

This does not only include links which are formed by <a>nchor tags, but
also other ways of doing it, like,
<span onClick='location.href="http://someurl"'> Blah blah..
</span>

In other words, all the events that can be raised by this piece of html
should be blocked.


For FF and Co you can use addEventListener('event',true) to capture
events from the top.

For IE5.5 and higher you can use setCapture() method:
<http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/setcapture.asp>
It will not prevent key events, but mouse events will be killed.

Aug 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Pretty woman | last post: by
4 posts views Thread by Marty McDonald | last post: by
3 posts views Thread by VK | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.