Title: go back to previous page when adding a Windows phone browser via c#
Tags: c#;windows-phone-8;windows-phone;browser;webbrowser-control
Question: I have a simple question regarding windows phone c#.
I created a new browser and added it to a grid via c#.
webBrowser browser = new webBrowser;
gridHost.Children.add(browser);
Everything works fine except that it seems If I use browser.goback() the page won't go back. I'm guessing after using that I would have to readd it to the grid? If so how would I go about doing this?
Comment: No you don't need to add it again to the grid. Try checking the CanGoBack property before you call GoBack().

Comment: Maybe your website is ajax based so it doesn't do normal page navigation. Can you share some links?

Comment: I tested it but for some reason it keeps returning as false

Comment: For my code I have
if(browser.CanGoBack == true){
browser.GoBack();
I navigate to google and click on a link but the browser.CanGoBack always returns false


Here is another answer: well there's an smart way, noob like but still it will turn out perfect!
Just create a grid for the your WebBrowser control on the xaml, drag in an Browser control. Rename it and resize it. choose how you want it to be.. then drag in two buttons and rename one button to "back" and the other "front". Go to Common in the properties and erase and rename the front button to ">" and back button to "<". then place them where ever you want them. after make a Event Handler for each button like ex. "Front_click". For the last make the visibility collapsed.
Now once that it's done, type the following codes.
To make the buttons and browser visible and also navigate to desired url.
webBrowser1.Visibility = Visibility.Visible;
webBrowser1.Navigate(new uri("your url..", UriKind.Absolute));
front.Visibility = Visibility.Visible;
back.Visibility = Visibility.Visible;
for the front button.
webbrowser1.InvokeScript("eval", "history.go(1)");
and for last the back button.
webBrowser1.InvokeScript("eval", "history.go(-1)");
And everything should look really awesome! I'm just showing my way to do this.
Anyways Good Luck man!

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 4, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2014:00:05/04/14', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<c#><windows-phone-8><windows-phone><browser><webbrowser-control>', 'Title': 'go back to previous page when adding a Windows phone browser via c#', 'ViewCount': 298, 'id': 23458568, 'user_AboutMe': None, 'user_AccountId': 4406728.0, 'user_DisplayName': 'user3590911', 'user_Reputation': 41.0, 'user_Views': 9.0, 'user_id': 3590911.0}}