Opening a linking to a website

Hi there, this post is just to let the community a problem I came across when trying to link a website trough a button. I did follow quite a few tutorials on how to get this behavior, everything went smoothly until I entered a website address into ActivityStarter1.DataUri without encryption that is without https.

I couldn't understand why I was getting an error. After reading and experimenting I found out that to be able to open a website using ActivityStarter1.DataUri the web address has to have encryption; http won't work it has to be https. Hope this information will help the community and avoid headaches and hair pulling :slight_smile:

I do not have the issue you describe. I am able to open http:// sites without issue. The best one to test is the AppInventor site!

image

Tested on Android 11 Google Pixel 4a using latest companion.

2 Likes

Show your Blocks please; neither Tim or I have issues with either http or https url's. What Android version are you using?

Either of these examples (Button1 or Button3 code) works on an Android 8.1

asOpenWebpage

They also work in the native Emulator (but they spawn a security warning..you can ignore).

1 Like

Hi TIMAI2, Hi SteveJG, the problem occurred when using Android version 6.0, thank you very much for your advise. From now on I will only try to use the latest Android version. I wish my problematic experience can help the community should they encounter a problem similar to what I experienced. Here are my blocks:

blocks

Hello Alberto

Your URL has a '/' missing, that might be the cause of the issue.

You can get onto the home page of many 'https' sites with an 'http' URL, including the one featured in your post, which is actually 'https' :koala:

Hi Chris, thank you very much :slight_smile:

How do I use the set activity action thing Iā€™m using ios

Refer to post #2 by TIMAI2 or click here.

hello! i am new to mit app inventor i have a school project and i have to make a random app in mit inventor.but i did not know how to use it.
i made an app where we can order coffee online, but idk how to link the button to a website.

Hi, I changed your text to lowercase. All uppercase looks like shouting and we don't shout here.

What is the complete URL that you want to link to? So your sample blocks don't work?

You need to switch the text blocks around, so that the url is in DataUri, and the intent is in Action.

But actually much easier to use the built-in webviewer....

Just to register, I've tried exactly this way TIMAI2 posted, but instead a Button, I've inserted an Image, marked it as clicable and just changed the "when Button1 .Click" for "when Image .Click" and it worked just fine. :smiley: