本文介绍了如何使用javascript在Windows 8 Metro应用程序中的不同html页面之间导航?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用javascript在不同的html页面之间导航?我试图使用下面的语句,但是它不起作用.我添加了一个断点,发现执行了以下语句.但是它仍然不显示page2.html.

How can i navigate between different html pages using javascript?I tried to use the below statement but it's not working. I have added a breakpoint and found that the below statement is executed.But still It doesn't display the page2.html.

WinJS.Navigation.navigate("page2.html", null);

谁能告诉我为什么在所有情况下都无法正常工作?我发现的一个选择是尚未尝试过的iframe.

Can anyone tell me why in what all scenarios it won't work ?One option I found was iframe which I haven't tried yet.

推荐答案

此API不是特定的页面导航器;这是关于根据WinJS中的位置服务定义的位置进行加载: http://msdn.microsoft.com/en-us/library /windows/apps/hh452768.aspx 详细介绍了使用该模型的细节.

This API isn't a specific page navigator; it's about loading the location as defined by the location service in WinJS:http://msdn.microsoft.com/en-us/library/windows/apps/hh452768.aspx has the details on the specifics of using that model.

也就是说,如果您希望使用新页面的普通Web模型,则使用普通链接或将window.location设置到另一页面上都会导致浏览器导航.

That stated, if you wish to use the normal Web model of a new page, either a normal link, or setting the window.location to the other page will cause a browser navigate.

这篇关于如何使用javascript在Windows 8 Metro应用程序中的不同html页面之间导航?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 00:07