As can be seen in the screencast below, I'm having a devil of a time getting webView:shouldStartLoadWithRequest:navigationType: to be called consistently.
In the screencast below, you'll see a UIWebview with three size selectors. When clicking on any of these three, webView:shouldStartLoadWithRequest:navigationType: should be getting triggered. Unfortunately, that doesn't always seem to be happening. It doesn't event seem to happen consistently.
http://screencast.com/t/ww6uwP1Je
So what's causing this? Is there an error method of UIWebViewDelegate that I could hook into to pick up some of what's going on internally?
It seems like you aren't setting the UIWebViewDelegate properly. I noticed in the screencast that it worked once you clicked the 'L' (presumedly "large") button. Is that method setting the delegate? If not, please paste a code snippet that shows the issue.
Since the other two buttons generate calls to the delegate we know your web view delegate is properly assigned.
The simplest explanation for the failure is that S button is not configured in HTML properly and does not generate a actual request for the web view to load. With no request, the delegate methods are never called in the first place.
Ok, turns out I didn't provide anyone enough information for anyone to answer the question - I even removed the relevant parts from the webview gist given above. Sorry!
Here's the full template:
https://gist.github.com/521d17e0377133725d9a
Turns out there was an onclick handler on the li surounding the link (see the gist above - "#sizes_slider li"). Removing that onclick handler did the trick.
Related
According to https://code.visualstudio.com/updates/v1_36#_hide-individual-status-bar-items we can now enable users to turn status bar messages on/off, but it doesn't point to a particular API to handle that ourselves.
I have looked at https://github.com/Microsoft/vscode-extension-samples/tree/master/statusbar-sample but it doesn't seem to show a method of handling that.
Is there a good example somewhere we can refer to?
I have not tried this myself, but going by the API docs, when you use window.createStatusBarItem you get back a StatusBarItem, which has a "hide" method. So calling that method seems like the first thing to try.
I'm trying to use TinyMCE in a widget but it fails. I think the problem is that view is still hidden when "viewAttached" is fired. It seems that TinyMCE has a bug/feature (read last paragraph) and can't be displayed when the target (textarea) is hidden (or inside a hidden div).
I got it working by doing the job in a setTimeout but it's crappy.
Is there a callback that I could attached to which is fired after the view is unhided (after the transition is completed)?
I found one solution:
Explicitly subscribe to the "isNavigating" observable of the router and add TinyMCE when "isNavigating" value becomes false.
Still : this has the effect of flickering - you see the textarea and then it is replaced by TinyMCE... but this is not a Durandal problem IMO.
Edit 1
Finally, I think the the best solution (for now... follow the link below for the thread on the subject) is to do a setTimeout(xyz(), 0) - I have seen a lot of people using this technique and it prevents the flickering.
https://groups.google.com/forum/?fromgroups#!topic/durandaljs/5NpSwMBnrew
Durandal does have a callbacks when you're using composition - you just put a function on to your viewModel with the correct name. In your case, you would use viewAttached:
Here's the docs:
http://durandaljs.com/documentation/Interacting-with-the-DOM/
I want to show a popover view on top of a webview. And the popover should be shown on selecting any UI element in webview. I am able to capture the touch event in a Javascript code . Can anyone help me.. Is it possible to post a notification event from the Javascript..? Is there any other way of achieving this..?
Thanks.
This is exactly what PhoneGap does. The idea behind it is that in response to the touch, your JavaScript loads a particular URL, possibly with a custom scheme. The web view delegate's -webView:shouldStartLoadWithRequest:navigationType: method is called before the web view actually makes the request. If the implementation of that method recognizes the URL, it can then take whatever action it likes, such as displaying a popover view.
You can easily call your scripts (with in the sandbox) from your objective-c methods. Thw Web kit has the methods for evaluating Script codes [webview stringByEvaluatingJavaScriptFromString:#"myJavascriptFunction()"];Check this tutorials to learn dig deeper Tutorial-1 and Tutorial-2.. hope this helps you...
Using Woodwing, we have a page that has custom html in it, using the custom web widget.
That widget has an anchor tag, that when tapped, opens a page in safari.
However, if we create the same page using the HTML widget, and a link overlay, that triggers a ModalView to display.
I'm assuming this has something to do with WoodWing's (un)documented protocols for the anchor tags, that are captured by the WoodWing shell application and used to trigger the "ModalView" display. Since everything in Woodwing generates an XML that is parsed when the app is loaded, and I've done numerous applications, this seems reasonable. However, there is very little technical documentation.
My question is: does anyone know any documentation on those protocols, or a way I can use custom-html to trigger the ModalView? I've tried replacing "http" with "ww" but no dice. It's possible it's javascript but I'm suspecting protocols...
The UIWebViewDelegate defines the webView:shouldStartLoadWithRequest:navigationType: method that your view controller can implement. In this implementation, your code shoudl decide if it wants to handle the request (user click) or let the UIWebView handle it normally.
For displaying a modal as a result of a click, this method would display the modal and return NO.
The default HTML widget implementation doesn't support this out of the box. There are two ways that you can do to achieve this;
Implement what they call a 'custom object'. They documented this feature, if you have access to their documentation this should be relatively easy to figure out. It allows you to write native objects and inject them into both the .ofip format and the application.
Implement a modal dialog within the widget (in HTML). This is less convenient but possible to do (if you have a fullscreen widget).
Create the specific URL for open as you mention in your comment(ww://string.string).
Then in UIWebView Delegate method (webView: shouldStartLoadWithRequest: navigationType:) get the redirect URL. If redirect URL is equal to you mention before then perform your action.
Let me know if this answer help you.
Thanks,
I am having much difficulty being able to dismiss (programmatically) my UIDocumentInteractionController's OpenIn Menu (Using the appropriate - dismissMenuWhatever method from the docs). I just can't seem to get it to work. Does anybody have any suggestions? Maybe I have an inadequate intelligence level? I am beginning to question the meaning of life.
make sure you are calling dimissMenuAnimated: on the right UIDocumentInteractionController. Maybe post some code if you still can't figure it out.