siti nasuha

unread,
Apr 10, 2018, 2:42:32 AM4/10/18
to MIT App Inventor Forum
hi..actually i have some problem to do the activity starter and how to include web viewer to filter the banned words.

SteveJG

unread,
Apr 10, 2018, 8:15:20 AM4/10/18
to mitappinv...@googlegroups.com
This question was answered in your previous thread  https://groups.google.com/forum/#!topic/mitappinventortest/auxBBMJaIeQ  

No one can use the App Inventor 2 WebView or ActivityStarter to block or filter 'banned' words.  When you use the ActivityStarter to view web pages, AI2 transfers control to your device's 
default browser .  Your AIL2 code blocks cannot modify how the default browser works.

This is impossible.

You can search for 'banned' words in a url page like this using either the WebViewer or the ActivityStarter.


The banned words in the example are boy and girl.  If either appear, the code will block the WebViewer or ActivityStarter from showing that page.  To test if this is really what you want to do, type google.com in the TextBox and substitute  google   for    boy in the banned words and get the message stating this contains a banned word.

This might be the best you can do.

SteveJG

unread,
Apr 10, 2018, 10:33:25 AM4/10/18
to MIT App Inventor Forum
Here is a way to check if a Web page contains any of a List of 'banned' words.  The technique uses a Web component, a list of 'banned' words and a WebViewer ...:

The longer the list of banned words, the longer this technique will takes to scrape the Web page seeking the unwanted words.   If the search finds a banned word, the notifier lets you know and hides the WebViewer.

Something similar could be done using an ActivityStarter (see my previous post) by modifying the code.

Is this really what you want to do?  The technique does not filter or hide the words it finds.  The Blocks prevent displaying a Web page if one of the offensive words occurs on the Web page's main page.   If the web site contains offensive words through a link, this technique will not work.

Regards,
Steve





siti nasuha

unread,
Apr 14, 2018, 2:31:12 PM4/14/18
to MIT App Inventor Forum
hi..can you suggest me on how to make web page 

SteveJG

unread,
Apr 14, 2018, 3:43:55 PM4/14/18
to MIT App Inventor Forum
A web page basically is an on line html file.  If you know how to make an html file, you can make a web page.  App Inventor is not designed to make web pages or html files.


Use a text editor or you can use a free tool like 

siti nasuha

unread,
Apr 14, 2018, 10:43:25 PM4/14/18
to MIT App Inventor Forum
i just use your given code but it shows an error. why?

SteveJG

unread,
Apr 15, 2018, 8:33:56 AM4/15/18
to MIT App Inventor Forum
The code works.  Post the blocks you coded and we can check it for accuracy.    

I do not know why you code results in an error.  It would be helpful if you post the code you actually use and the error message.

 Depending on the url you put in the TextBox1, you may need to replace the two instances of   https://    with   http://      or you could try entering in the TextBox1  google.com  .    Is that the issue?    If  this is not the issue, post your blocks please .  Are you using the WebPage code (the second code posted) or the ActivityStarter code (first code posted).

Also, do NOT eMail Forum posters directly please unless requested.

SteveJG

unread,
Apr 15, 2018, 12:12:08 PM4/15/18
to MIT App Inventor Forum
This is a more detailed example using a WebVIewer and Web components.  It searchs a website for certain words.  The app loops through a List to find the Words in the Web page.  When the app finds one of the words in a List, the search stops, the WebViewer is hidden and you are notified that a Word was found on the website.

The Word  the    was found on the website page

Alternative List of Words is checked. No banned words found so the web page displays.


The Blocks.   


 Some sites require that the url  is prefixed with   http://    and other web pages require https:// (secure) when using the Web and WebViewer controls.  If the incorrect form is used, you probably will see an error displayed. There are two places in the code where you can set the app to use http or https.  Currently the app uses  http://  .

The words List is contained in a  csv file of the words you want to search.  The csv can be hard coded in a Text block (as in the example) or you can make and upload a text file to Media and access the csv using the File control.  How to do that is not shown.



Regards,
Steve





URLWebViewer.aia
Reply all
Reply to author
Forward
0 new messages