开发者

Possible to refresh browser page from another tab

I have a silverlight application. This contains a "preview" button. Button code is as follows:

private void btn_Preview(object sender, RoutedEventArgs e)
{            
    HtmlPage.Window.Navigate(new Uri("http://www.开发者_开发问答google.com"),"_blank");
}

When I clicking the button in firefox, a new page is created in a new tab. When I click again, another new page is created in another new tab. When i click 10 times, 10 tabs are created.

I want that If my target page already opened, don't create new tab. only refresh previous tab.

Same as google blogger Preview button of "edit html" section

I want do it from silverlight 4 or javascript

Is it possible?


Change _blank to a unique name for your application.

private void btn_Preview(object sender, RoutedEventArgs e)
{            
    HtmlPage.Window.Navigate(new Uri("http://www.google.com"),"myApplicationName_previewWindow");
}

With _blank you are specifically asking it to open a new window each time.


Rather than giving _blank as the name of the new window, give a particular name like preview_window. Then all the clicks should open the content in same window.

Note: I don't know Silverlight. I am guessing the solution from the similar behaviour in JavaScript.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜