WebView href navigation
Hello Community,
I am trying to create a book where I have the toc as a table (got that working) and then the pages are webviews off the table (got that working). Now I am trying from one webview to go to the next chapter (having problem here).
I have tried just creating a href link to the local file but that did not work. I have also tried removing the current view and creating the next view through fireevent but I can not get that to work either.
If you have any suggestions please send them my way. Also code samples help a lot:)
Thanks.
2 Answers
-
The href links used to work. Doesn't now though. ??
One more thing that got broken in local web views.My solution was to change the web view url when the user clicked on the edges of the screen.
webview.url = 'p101.html';
-
Your tags don't say which platform you're on, but you should be able to do something like.
Ti.App.fireEvent('nextPage', { currentPage : 1});
and have your application listen for it and set the html for the next page.
Ti.App.addEventListener('nextPage', function(e) { webView.html = getPage(e.currentPage + 1); });
where getPage is a function you write to return the source for the page. I didn't put error handling in the example so you'll need to do that.