Link with parameters

Hey Guys,
I have a problem with the “open Link” block.
The Url I want to open is somewhat variable. It is created with the “join” block from a fixed url Part and a variable part that enters an article number in our shop. Looks like this:

https://www.sampleshop.com/search?sSearch=” + “productnumber123”

When I alert it, the Url is created correct. But when I click on the link in the app the behavior is strange. Most of the time 2 tabs in the browser are opened. One with only https://www.sampleshop.com/ and in the background one with the correct url.
Sometimes only the base url is opened…

Any ideas?!
I tried storing the complete url in a variable and handing it to the “open link” block. But that did not help…

1 Like

Does your URL string contains spaces?
The open link will not process spaces in the URL and will not resolve incomplete URLs even if it is just a missing “http”.

nope, no spaces.

I agree that there could be a special character causing an issue. If you’re able to share the actual URL, that would be helpful. If not, try using the “join” block in the text drawer to add something like a bullet (•) to either side of the URL block you are using. Then display the value in a label and check to make sure it’s what you expect it to be such as:

•https://www.sampleshop.com/search?sSearch=productnumber123•

This is going to be really hard to troubleshoot without seeing your blocks and/or the actual URL, though.

1 Like

Sure I can share the url:

https://w-ww.radicalracing.de/search?sSearch=RR.004.12-BK

I use the Join Block to connect the static part “https://w-ww.radicalracing.de/search?sSearch=” with a variable which contains the product number.

(Note: I added the - in www to prevent the “preview” of this page to show the page instead of the url)

When I try opening that link in Thunkable Live on iOS or Android, it just loads the page as I’d expect. Do you want to share the project link or screenshots of your blocks? There may be something you’re doing that’s affecting the display of that page.

1 Like

I can share the blocks here:

The function is called when the page loads.
It calls an api which returns an object containing an article number.

Thanks in advance for your help!

And just to be clear, if you set a label’s text to the variable shopLink inside of the “when label-Shop-Link Click” block and remove the open link block, you get exactly this?

https://w-ww.radicalracing.de/search?sSearch=RR.004.12-BK (without the dash between w-ww, and without any leading or trailing spaces)

And if so, what happens if you disable the API section of blocks and just try a simple test of “when label-Shop-Link Click” → open Link https://w-ww.radicalracing.de/search?sSearch=RR.004.12-BK ???

2 Likes

Ok, so this behaves strange!
I did what you said and removed the “Open Link” block. Then I added “change text of label to the link variable”.
It DID change the text of the label to the correct link. BUT it also opened the link in the browser xD.
So now I did the following. Which does what I wanted to do in the first place. But I don’t think it should behave that way. Just tested it in live view on android. Will test on ios too.

Note: The second block just changes the text of the label back, so when the user gets back in the app, he does not see al log url…

If you disabled/deleted the Open Link block and it still opened a browser on the device then you have a second Open Link block somewhere. Have you tried zooming all the way out on the Blocks tab screen to make sure you don’t have stray code?

1 Like