Solved

WebBrowser delete tag

Posted on 2010-08-30
8
336 Views
Last Modified: 2012-05-10
Hi,

How can i delete tag from webbrowser component?
Or how i can get tag source by tag name?
0
Comment
Question by:lavitz
8 Comments
 
LVL 36

Expert Comment

by:Geert Gruwez
Comment Utility
you can hide it be recreating a new component
but it takes a special function call

is it something like that your are looking for ?

you can't hide it from the standard component
0
 
LVL 36

Expert Comment

by:Geert Gruwez
Comment Utility
in the new package you need to call this procedure from DesignIntf

procedure UnlistPublishedProperty(ComponentClass: TClass; const PropertyName: string);

you do this after the call to registercomponent.


UnlistPublishedProperty(TWebBrowser, 'TAG');
0
 
LVL 36

Expert Comment

by:Geert Gruwez
Comment Utility
0
 

Author Comment

by:lavitz
Comment Utility
Iam using webbrowser for mail editing. In edit mode, source mail have additional tags and scripts that are using only when editing. Before mail save iis done i need to remove these tags end scripts so i search for safe solution to remove them.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:lavitz
Comment Utility
And by 'tag' i mean html tag i.e <SPAN>
0
 
LVL 36

Expert Comment

by:Geert Gruwez
Comment Utility
ah it's in the source code of the html

if you have the source, then you can use posex on that if you have a unique way of distinguishing the tags

<TAG ID=1234 ...> </TAG>

n := PosEx('<TAG ID=1234', html.sourcetext);
m := PosEx('</TAG>', html.sourcetext, n);
Delete(Html.sourcetext, n, m-n+5);


0
 
LVL 13

Accepted Solution

by:
aflarin earned 500 total points
Comment Utility
if your span tag has id or name attribute like this:

<span id="tag_name"... or <span name="tag_name"...

you can use this code:

  WebBrowser1.OleObject.Document.all.Item( 'tag_name' ).removeNode( True );

if no - please show all html code, because it need to find where span tag is located
0
 
LVL 2

Expert Comment

by:adlabac
Comment Utility
If you want to remove all tags in a message you can use this function. Just pass the complete message as a string and it will return the string with all tags removed. If your message is not in one string, simply repeat the procedure for each one.
Function RemoveTags (Code:string) : string;

  Var Start, Stop : integer;

    Begin

      Result:='';

      Start:=Pos ('<',Code);

      While Start>0 do

        Begin

          Stop:=Start+1;

          While (Stop<=Length (Code)) and (Code [Stop]<>'>') do

            Inc (Stop);

          If Stop>Length (Code) then

            Exit;

          Code:=Copy (Code,1,Start-1)+Copy (Code,Stop+1,Length (Code)-Stop);

          Start:=Pos ('<',Code)

        End;

      Result:=Code

    End;

Open in new window

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now