473,399 Members | 2,774 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,399 software developers and data experts.

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 1306

<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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Pretty woman | last post by:
Hi, I am new to web technologies, including HTML, SVG and javascript. I followed the courses for these languages on www.w3schools.com. I have a question about events raised by a SVG document....
9
by: Marek Mand | last post by:
How to use generated keyboard events? What I am trying here to do is in onkeyup event handler http://www.hot.ee/idaliiga/braggart/createEventTest.htm generate a (shift)TAB keydown so the...
4
by: Marty McDonald | last post by:
It is still unclear to me why we would use events when delegates seem to do just fine. People say that events make it so the publisher doesn't need to know about the listeners. What does that...
3
by: VK | last post by:
To PointedEars with my deep respect. Author ;-) There were a question a while ago about events. Now I see that my original explanation was not full. Check this sample out: <html> <head>...
5
by: knocte | last post by:
Hello. I am a web developer very worried about "bloat code" and "languages mixture". So, since some time, I always try to avoid completely the use of javascript in XHTML/HTML files. This leads...
6
by: Dominique | last post by:
Hi all, I'm using .NET v1.1 and the scenario I have is as follows... I have IE as an ActiveX control embedded in may C# App. I generate a HTML file dynamically and within the HTML file I embed a...
51
by: Paul Gorodyansky | last post by:
Hi, Ran into the following problem while trying to have a code to attach a Virtual Keyboard to any user's form: User clicks a button and my JavaScript changes outerHTML of say <textarea -...
2
by: Safalra | last post by:
Recently I've rewritten much of my old Javascript code to use DOM functions so that enhancements can be attached to documents without needing to alter the HTML code. I assumed that adding event...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
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
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.