How to run bookmarklet in Safari on iOS [duplicate]

Apart from opening Safari manually and selecting the bookmark from your favorites, you can also pin it to your homescreen were you can tap the icon and it'll open Safari for you and run the Javascript. Although for that you need to use a slightly different address.

data:text/html,<script>alert('test')</script>

Visit the above and after the page is loaded you can then tap share and select pin to homescreen. After that you can just tap the icon.

Those are the only two ways to run JS/HTML script.