Interceping a link in a web view
I have a small webview above a larger scrollview, the webview is used to display an image with a link. When the image is clicked the link is opened in the small web view.
Is there a way to intercept this click on the link and open in a new larger webview. The link will always bring the user to the app page so I would like it to go to the app store on the iphone
Is both of these possible?
3 Answers
-
If the small webview loads a local webpage, you could communicate form this to Titanium using events. If you load it from a server is a little more complicated but doable.
Basicaly you declare in app.js a custom event that opens the bigger webview, and in the small webview you trigger this event what the link it's clicked.
Why do you use a webview only for an image? you can use the click event on that image. Webviews are costly for the device.
-
Hi,
I am using just simple webview.html, but the href and src actually call out to adtech(advertising) server that presents an image with a link - this will always be dynamic.
-
Ok You will have to load the webview from adtech using xhr (the result will be a string), modify it ( add onclick event to the link you want) then set all this as html property to the small webview.
Painful but doable.
Hope it makes sense :)