# \[Pro\] Strip everything except content of Body tag

**URL:** https://discourse.softpress.com/t/pro-strip-everything-except-content-of-body-tag/24568
**Category:** ActionsDev
**Created:** [March 23, 2020, 11:50am UTC](https://discourse.softpress.com/t/pro-strip-everything-except-content-of-body-tag/24568 "2020-03-23T11:50:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Unknown\_User](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/u/ac91a4/32.png) [@Unknown\_User](https://discourse.softpress.com/u/Unknown_User)
#### Post date: [March 23, 2020, 11:50am UTC](https://discourse.softpress.com/t/pro-strip-everything-except-content-of-body-tag/24568/1 "2020-03-23T11:50:15Z")

</div>

Hi!

I’ve been playing with the code given in the Actions Reference PDF to try to strip a page down to just the Body contents.

I’ve got this far:

> var doctypeTag = fwDocument.fwTags.fwFind(‘!DOCTYPE’);

> doctypeTag.fwDelete();

> body = fwDocument.fwTags.fwFind(“body”);

> bodyContent = body.fwFindAllContent();

> html = fwDocument.fwTags.fwFind(“html”);

> html.fwDelete();

> fwDocument.fwTags.fwMove(bodyContent);

But it only outputs the Table tag, not any of its TR contents.

Any ideas?

Cheers, Ian.

* * *

actionsdev mailing list  
email@hidden  
Update your subscriptions at:  
[https://freewaytalk.softpress.com/person/options](https://freewaytalk.softpress.com/person/options)

---

<div class="post-metadata">

### Author: ![waltd](https://discourse.softpress.com/user_avatar/discourse.softpress.com/waltd/32/2720_2.png) [@waltd](https://discourse.softpress.com/u/waltd)
#### Post date: [March 23, 2020, 2:41pm UTC](https://discourse.softpress.com/t/pro-strip-everything-except-content-of-body-tag/24568/2 "2020-03-23T14:41:15Z")

</div>

I would take a look at the PHP Make Insert Page Action for some reference code. [PHP Make Insert Page - ActionsForge](https://actionsforge.com/actions/php-make-insert-page) Check the source to ensure that there are some updates in it from me (last one was in 2010). If you don’t see that, please let me know.

Walter

> On Mar 23, 2020, at 7:50 AM, Ian Webb via actionsdev [email@hidden](mailto:email@hidden) wrote:
> 
> Hi!
> 
> I’ve been playing with the code given in the Actions Reference PDF to try to strip a page down to just the Body contents.
> 
> I’ve got this far:
> 
> > var doctypeTag = fwDocument.fwTags.fwFind(‘!DOCTYPE’);
> 
> > doctypeTag.fwDelete();
> 
> > body = fwDocument.fwTags.fwFind(“body”);
> 
> > bodyContent = body.fwFindAllContent();
> 
> > html = fwDocument.fwTags.fwFind(“html”);
> 
> > html.fwDelete();
> 
> > fwDocument.fwTags.fwMove(bodyContent);
> 
> But it only outputs the Table tag, not any of its TR contents.
> 
> Any ideas?
> 
> Cheers, Ian.
> 
> * * *
> 
> actionsdev mailing list  
> email@hidden  
> Update your subscriptions at:  
> [Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk](https://freewaytalk.softpress.com/person/options)

* * *

actionsdev mailing list  
email@hidden  
Update your subscriptions at:  
[https://freewaytalk.softpress.com/person/options](https://freewaytalk.softpress.com/person/options)

---

<div class="post-metadata">

### Author: ![Unknown\_User](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/u/ac91a4/32.png) [@Unknown\_User](https://discourse.softpress.com/u/Unknown_User)
#### Post date: [March 23, 2020, 3:24pm UTC](https://discourse.softpress.com/t/pro-strip-everything-except-content-of-body-tag/24568/3 "2020-03-23T15:24:40Z")

</div>

Hi Walter!

Thanks, that got it! I think the bit I was missing out was the ‘enclosesHTML’ part but, to be honest, I still don’t understand how it works!

I’ve posted it to ActionsForge: [Strip Head &amp; Body tags - ActionsForge](https://www.actionsforge.com/actions/strip-head-body-tags)

Cheers, Ian.

* * *

actionsdev mailing list  
email@hidden  
Update your subscriptions at:

> **[Information for existing FreewayTalk / Groups.io users](https://discourse.softpress.com/t/information-for-existing-freewaytalk-groups-io-users/24891)**
>
> The purpose of this topic is to provide information about the migration from FreewayTalk and Groups io to Discourse and the differences in Discourse, as well as a place to discuss the good or bad of the migration. For those previously subscribing...
