Question: Which "Open link" block conditions lead to the "On error" state?

The “Open link” block has a “On error” part:

image

Does anyone know what could lead to the “On error” state? My question originates from my attempt to launch an app if installed using its URL scheme (examples) and get an error if it does not exist which means that the app is not installed and in that case, launch a web page version of the content I am trying to access.

So for example I am trying to open a Facebook page in the app if it is installed and if not, launch the web browser and display the page there. Logically, just using the page’s URL would work but at least on iOS it opens the web page version even if the app is installed. Then I am trying to use the fb:// scheme which does work if the Facebook app is installed but it does nothing if it is not since the fb:// scheme is not known to the OS unless the app is installed.

What would help would be to get an error returned from the “Open link” block if it tries to open a link (fb:// in this case) and “Open link” actually did return an error. I would then create an if-then-else statement to deal with the conditions.

Any ideas on this? Anyone knows what triggers the “On error” state?

Thanks
K

1 Like

Hi, @Deluxe! :wave:


Yeah :smile:


For checking error blocks, try this -

image


Were you looking for this?
If so, this would help you :wink:


Thanks! :blush:

My point exactly. In my testing, the logic does not ever reach the “On error” part of the block. Are you telling me that in your example, your “On error” part executes and you hear the “Sorry…” part?

Thanks
K

1 Like

Hi,


Do you encounter an error in your device?

More clearly, -
Assume that you don’t have any browser in your phone.
And you are trying to open the link - www.youtube.com in your app; you have also added a vibrate block in the on-error area.
Does your device vibrate? or nothing happens? (for this case)

If so, then it might be that


Thanks! :blush:

Hey Kartik

Let’s let the code do the talking:

https://x.thunkable.com/copy/cfc2ae3edc9f01b0f444c6b514abbcc1

Do you get “Error” in the text box or not?

Thanks
K

…also, there is no specific reference to the “On error” state in the official documentation:

https://docs.thunkable.com/control#open-an-installed-app-or-website-by-link

So has anyone ever made it to the “On error” part? If so, what caused that?

Thanks
K

1 Like

Hi there, @Deluxe
You can use it if device not is online
Popup a message that accounces “You should turn on your connection”

Hey @BlueWhaleYT. So what you are saying is that, to your knowledge, the only case the “Open link” block will trigger the “On Error” condition is if the device is offline?

@Mark can you please help us understand under which conditions the “On Error” condition is met? In this case, shouldn’t it be met if we request the “Open link” block to open an unknown to the device scheme URL? I believe it should.

Thanks
K

Not sure what your point is with the above screenshot. Can you please elaborate?

That show you to link that website
on error ( if user have not turned on connection ) (in this case)
from label or using the alert to tell the user.

Ok I understand that. You just post an example of your previous comment that the “On error” condition will be met if the device is offline. Yes, this is clear, we understood that.

So my question to the rest who follow this thread is if this is the only case the “On error” condition will be met and under which other conditions it will be met (i.e. trying to open an unsupported scheme URL).

Thanks
K

Hi, @Deluxe! :wave:


Yeah.
But, it will also be met if a browser is not installed.
If you don’t have an internet connection, i think it will go to your browser, and the browser will show no internet.


This can be the problem too.
I think you should try with a more standard URL, like google.com.


Likewise. you were trying facebook’s, right? I assume that you have facebook installed in your phone.
If it is, try in a phone on which facebook is not installed :slight_smile:


I am currently trying on mine (with no facebook), will report here :blush:


Thanks! :blush:

Hey @kartik14

I appreciate your help and expertise but let’s please stick to what we can prove though code and not assume. You provide two cases:

  1. " But, it will also be met if a browser is not installed."
  2. " I think you should try with a more standard URL, like google.com."

On the first point, if what you say is correct, any links provided in the “Open link” part of the block containing http:// or https:// would return an error message, right? If so, why is it that no similar error is returned if I am using fb:// or flickr:// when neither Facebook or Flickr are installed on the device? Did you assume we would get an error message or did you actually test?

On the second point, “google.com” is an address, not a URL scheme. By URL scheme I mean what is listed in this link and I have mentioned in my initial message in this thread.

Thanks
K

1 Like

I did just now, schema(s) are not working for me :neutral_face:
No error, nothing :man_shrugging:


I think, it’s for iOS only -


What device are you testing on?
I have a Galaxy A50…

Thanks! :blush:

@kartik14 I am not talking about the specific iOS services!!! I am taking about apps!!! I never mentioned iOS services in my message!!! I mentioned Facebook and (to add one more example) Flickr!!! Posting irrelevant information is misleading to the rest who follow this thread! Please, let’s stick to the point!

And no, it is not related to iOS only, I tested on both iOS and Android and I am getting the same. I even built a test app to help with testing mentioned in one of my responses:

https://x.thunkable.com/copy/cfc2ae3edc9f01b0f444c6b514abbcc1

Did you test with it?

Thanks
K

On Android 8.1 and iOS 12.4, no error occurs when trying to open a nonexistent link.

%D0%B8%D0%B7%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B5%D0%BD%D0%B8%D0%B5

I did not manage to make an error in this block

1 Like

Thank you @actech.

So shouldn’t this logically be considered as a bug since we don’t have any documentation as to when the “On error” state is met? @Mark?

Thanks
K

I agree with you. This block looks rather strange. If an error occurs, then there must be a local block in which to place the error text. But there is no local block and there is confusion and misunderstanding of why the “on error” part is needed at all.

2 Likes

There are currently two circumstances when an error will occur. The first is if there are no registered apps to handle the provided URL. The second may occur on those cases where a dialog is opened to allow the user to choose which app to handle the URL. In that second case an error will be returned if the user cancels or dismisses the dialog.

We should add this to the documentation.

Hope this helps.

-Mark