[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

WebBrowser delete tag

Hi,

How can i delete tag from webbrowser component?
Or how i can get tag source by tag name?
0
lavitz
Asked:
lavitz
1 Solution
 
Geert GruwezOracle dbaCommented:
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
 
Geert GruwezOracle dbaCommented:
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
 
Geert GruwezOracle dbaCommented:
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
lavitzAuthor Commented:
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
 
lavitzAuthor Commented:
And by 'tag' i mean html tag i.e <SPAN>
0
 
Geert GruwezOracle dbaCommented:
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
 
aflarinCommented:
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
 
adlabacCommented:
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now