Embed Web Page in an App - c#

I've created a simple Windows Phone app that launches the Google+ Mobile site. What I'd like to do, though, is a bit more complicated than that, and I have absolutely no idea how do to it.
Basically, I need help with this:
Embed mobile Google+ in an app.
If a user clicks on a link that's not on the same domain, open that link in IE
Have an application bar with "back" and "home" buttons. Back could work with the built in back button if that'd be better.
If someone can point me in the right direction, that'd be great. If someone wants to help me with this project, that'd be even better.

Using a WebBrowser control.
You can create a handler for the Navigating event for the WebBrowser to check for the domain. Something like this:
<phone:WebBrowser Navigating="OnNavigating"/>
private void OnBrowserPostNavigating(object sender, NavigatingEventArgs e)
{
//check for domain here, open IE accordingly
}
You can latch onto the hardware back button and use that for your navigation similar to the way IE does on the phone. If you search SO there are plenty of questions regarding that. For the Home button, simply use the <phone:PhoneApplicationPage.ApplicationBar> xaml element and add a button with a handler to do the navigation for you.

Related

Visual Studio 2015 How to make the WebBrowser control unclickable

So I'm trying to make a simple app for me and my friend. The app is used for his radio station. I currently have a basic WebBrowser control. The WebBrowser control is locked at a certain location on twitter, so that you can see all the tweets his radio station tweets out.
It looks good and works fine. The last thing I need to do is to make the WebBrowser control unclickable, whilst you can still scroll through the internet page. This means that I don't want people to be able to press on a tweet in the list. I tried putting a transparent panel of the browser, this just creates a hole in the browser and shows the background.
Does anyone have an idea how to make the WebBrowser control unclickable?
A possible solution would be to stop the browser from navigating anywhere:
wb.Navigating += (s, e) => e.Cancel = true;
But I honestly don't know if that will also work for any fancy AJAX techniques.
If you want to enable some navigation you can also check for the e.Uri or possibly allow the navigation if e.NavigationMode == NavigationMode.Refresh.
I am not sure if that would work but try creating click event and place only 'return;' instruction in the event code. that should cancel the click.

How to create and store history list in xaml page for a browser control for wp7

I have been working on a browser app for wp7. I thought i would add some extra features to my app. So, I thought i would create a history page for my app. But am new to Isolated Storage and i dont know how to save the history in a new page.xaml and also i want to see and access it, like if i click on any history, it should redirect to that page. Can anyone help me, because am new to these things. Thanks in advance!
Create a Stack object in app.xaml.cs lets say WebHistory.
Stack<Uri> WebHistory = new Stack<Uri>();
Now handle the LoadCompleted event for the browser control.
In the load completed event handler call App.WebHistory.Push(e.Uri);
You can bind it to a list where you want to display the links. and tap of the link navigate the browser to that particular link.
I hope this helps

Webbrowser and IE acts differently?

I'm in a trouble trying to fix some problem.. I have a program with Webbrowser control inside it.
It automates crawling process from some website. The problem is that I cannot fix webbrowser after recent website changes.
They have changed page navigation on website. And when I do actions MANUALLY in webbrowser (in my app) it doesn't go to the next/previous page on website. It does nothing... Whereas it works properly in IE 7/8/9 (only scripting errors thrown this time).
So does it mean that Webbrowser is not fully similar to IE??
I'm sorry for not showing source codes here, I think it wouldn't help here. Which way should I go to troubleshoot it? Why page navigation is not working in Webbrowser control?
I tried to simply put Webbrowser on a Window Form in new project and tried to navigate page 2/3/../10 in the website catalog, but it simply changes page number and doesn't navigate to it...
EDIT: Website doesn't work propely even if I do actions manually in webbrowser using mouse clicks.. but works in IE.
EDIT2: I might be not clear in my question. The problem is that I cannot use website even Manually with mouseclicks via my Webbrowser control in app. It changes page number after I click on it, but it doesn't navigate to that page. It stays silent. I'm sure that AllowNavigation property is true. It worked just yesterday and stopped after website changes today... Please tell me which way should I go to troubleshoot it.. I thought that Webbrowser control acts the same way as Internet Explorer.. Any help from you highly appreciated! Thanks
EDIT3: Strange thing... i just loaded Extended Webbrowser and navigated to that website. Page navigation panel doesn't work there also.. Is it a bug on their side or some type of guard from crawlers? What do you think?
(http://www.codeproject.com/KB/cpp/ExtendedWebBrowser.aspx)
I'm sure this isn't the answer your want but using the webbrowser control to scrape websites is very painful to maintain.
Instead use the HttpWebRequest and HttpWebRepsonse objects to recreate the calls to the webserver.
You can use Fiddler (http://www.fiddler2.com/fiddler2) and your browser to record your web sessions and recreate them in code.
You can setup your webbrowser control to disable a number of features including navigation.
I.e. to disable nav in the C# WebBrowser control:
webBrowser1.AllowNavigation = false;
I'd double check that you're not doing anything like this.
I had the same issue with a certain web site that recently changed its format. It has to do with the version of IE used by the control.
Simply force the IE version used to the latest (in my case 9). Setting the appropriate registry item to 9999 for my application worked; see: Webbrowser control behaving different than IE

How to complete some task on click of a button and then navigate to a different page?

I am developing a winform app which is controlling a website. On click of a button in winform app i want to fill a form, click the submit button on the web page upon which a new page will open , on that page i have to click on a link.
How to achieve this. i have tried many things but did not got any proper solution
If you're looking for a web automation tool, use Watin. It allows you to automate via code the opening of a browser, the clicking of buttons, and the fillout of form fields. However, that is more of a testing library.
Honestly though, your choice of solution sounds odd. You're trying to get a client application to make requests through a web page, instead of directly requesting whatever resource yourself from the client application. It's hard to give you a direct solution without a good understanding of the problem space.

Silverlight Browser back button to work

In my Silverlight app how can I determine if the Back button is pressed and to not logout, as it is currently doing. I may have a problem as the app is primarily a grid with drill down but at least if it could return to the start page, would be great.
I think the only way to trap that is with javascript. And the only thing you can do that way is to get an OK Cancel standard messagebox.
Or what you can do if you want to manage different pages with silvelight; create a Silverlight Navigation application (with the appropritate template).

Categories