Hey folks I was wondering if anyone can tip me on a painless way of invoking a modal view controller from a web link in a UIWebView. Is it possible to do this?
I want the modal view controller to still be a part of the app as opposed to closing the main app and using a helper application instead.
Any help would be greatly appreciated.
The best way to do this is by intercepting certain URLs in the UIWebView's delegate function
– webView:shouldStartLoadWithRequest:navigationType:
This can be called from javascript by setting the window's location:
window.location = "mycomprotocall:showMoadViewController";
Parse this in the delegate function, then execute any native code you like.
If you're using vanilla webpages that can be accessed from safari mobile, it is not possible. If you're programming a local webapp with phonegap or similar technologies, it is fairly easy, just catch the urls you want and handle them differently.
Related
I'm planning on create a desktop app for a customer, which will be basically a webview (displaying some page only accessible in this app), and two widgets.
But this page needs to have a couple of links/buttons that will trigger some events (outside the webview, obviously) in the app, calling the widgets.
It is possible? How?
I've made a little research and didn't found any resource on that.
Thanks in advance!
You can use JavaScript to call Action Script 3 (and also you can call JS methods from AS3) methods using ExternalInterface (http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7cb2.html).
I have a requirement of having the same URL throughout the application navigations. Like below
http://www.[Site Name]:com. (Here User should not have the idea of chaning the URL from one page to another page)
I am using ASP.NET MVC3 with latest Razor View Engine,
Can some body give suggestions on this?
Advanced Thanks,
Satish Kotha
This may make it very difficult for users to access your site - they won't be able to bookmark a specific page, for example.
It sounds like you want a single-page-app (e.g. like Google Mail or Reader). In this case, you have one page and make heavy use of AJAX. You can query the server via javascript, and send back Partial Views, or raw data in JSON format which can be rendered on the client, possibly via some kind of templating engine.
As Graham Clark has already mentioned, this functionality will most likely be frustrating for the user; however, achieving it depends on the complexity of your project. You may want to look into using jquery to load partial views into the main content area of your site.
When you click on your navigation you can use jquery's load() to replace the main content on the page. Jquery-load-with-mvc-2-partialviews is an interesting blog post that may give you more insight into what you would want to do. Your code to load content could look something like this:
$("#mainContent").load("/Controller/Action",
{parameter}, function () {
// perform javascript actions on load complete
});
I have a webpage with a hyperlink "myapp://mypage?id=123456&name=hello" , clicking the link is supposed to trigger the webbrowser Navigating event so that I can catch the url and do something meaningful. The problem here is that the Navigating event is not triggered at all.
I tried normal website eg: "http://xxxx.com" and it works. So is there a way to deal with user custom urls with webbrowser control?
ps: IsScriptEnabled is True
thanks
From my investigation into this, WebBrowser.Navigating only gets called if you attempt a hyperlink when using the file, http and mailto protocols. Custom protocols are not even served.
Digging around the web for custom extensions leads me to believe that it is possible to implement something that works around it, but doing so would be a great deal of headache and pain.
If you do/did find anything, please post it, as I would be interested to see your solution.
In facebook after I shared something in my wall I get a nice pop message about my activity. Sometimes whenever there is an error with they gave a nice pop about the error. Like this.
I know in facebook everything is about ajax.
I am creating a web application using mvc 3 asp.net. In my web app there is something similar to sharing links like in facebook.
I implemented this feature using ajax and partial views and it is works fine.
When user submit a new link, In my controller action method I update the db and return a partial view finally update my view with nice animation.
Now my problem is how can I give a pop up response while updating my view(facebook wall).
I want to do both of them with the ActionResult.
I not sure this is the correct way to do this.
Briefly what I want is update my view with automatic pop up response. Hope you understand what I want.
Let me know If you need any clarification on this.
Please help me to implement this function.
Thanks !!
Well a "popup" is client-side functionality, not server-side. You can't do it with actionresult per-se.
Perhaps you should return a PartialViewResult from an action method, which is fired by an AJAX call (e.g jQuery).
Then in the callback, set the HTML of a hidden container/div to the partial view's HTML, then show it in a fancy way.
Something like jQModal or jQuery UI dialog is perfect for this.
I found the answer myself. Add Jquery library and unrobustive javascript and
return JavaScript("alert('Some message')");
I thought I would ask here about how to develop a wiazrd like control
in ajax for MVC before I started it.
The control will have pages that have data entry controls and
on each page submission insert data into a database.
Any ideas how to go about this?
Malcolm
Are you using a JavaScript library? I know dojo has a wizard in dojox namespace, and I'm pretty sure there are wizards for jquery. If not, I'd do a wizard just like I would tabs, without the tab bar, and each view contains a form and next, previous, cancel and or restart buttons, all of which would handle the ajax calls/state management and change the view.
If it's a wizard you probably actually should use separate web pages rather than having a single page that's updated through ajax calls, that way the forward and back buttons can work as nature intended in the browser for moving forward and back through the wizard.
Of course you can use fragment tricks to get forward / back working in a single page but in my experience this is tricky.