Iphone 在webapp中打开URL时,如何在其中显示新页面而不跳转到Safari?
我有两个网页在一个目录的iOS网络应用程序。一个是index.html,另一个是detail.html 在index.html中,有一个指向detail.html的链接,如下所示Iphone 在webapp中打开URL时,如何在其中显示新页面而不跳转到Safari?,iphone,ios,web-applications,iphone-web-app,Iphone,Ios,Web Applications,Iphone Web App,我有两个网页在一个目录的iOS网络应用程序。一个是index.html,另一个是detail.html 在index.html中,有一个指向detail.html的链接,如下所示 <a href="detail.html"> Redirect </a> 我在iPhone的safari中打开index.html,然后将index.html添加到主屏幕,然后从主屏幕打开这个web应用程序。点击“重定向”后,web应用程序进入后台,然后Safari打开detail.ht
<a href="detail.html">
Redirect
</a>
我在iPhone的safari中打开index.html,然后将index.html添加到主屏幕,然后从主屏幕打开这个web应用程序。点击“重定向”后,web应用程序进入后台,然后Safari打开detail.html并进入前台
如何在web应用程序中打开detail.html而不重定向到safari?
特别感谢 我在中找到了解决方案
我最终使用javascript而不是label
<SCRIPT LANGUAGE="JScript">
function toDetail() {
document.location=('detail.html');
}
</SCRIPT>
<div class="cell" onclick="toDetail()">
</div>
函数toDetail(){
document.location=('detail.html');
}
我在
我最终使用javascript而不是label
<SCRIPT LANGUAGE="JScript">
function toDetail() {
document.location=('detail.html');
}
</SCRIPT>
<div class="cell" onclick="toDetail()">
</div>
函数toDetail(){
document.location=('detail.html');
}
要结合克服此类Web应用程序问题所需的所有功能,只需使用此库即可
如果您正在寻找快速修复:
$( document ).on("click","a",function( event ){
if($( event.target ).attr( "href" )){
var str = $( event.target ).attr( "href" );
var patt = /^#/g;
var match = str.match(patt);
// Stop the default behavior of the browser,ie to change the URL of the page.
event.preventDefault();
// Manually change the location of the page to stay in "Standalone" mode
// and change the URL at the same time.
location.href = $( event.target ).attr( "href" );
);
这将处理所有锚定标签。。可以使用“match”变量排除具有“#”值的HREF
此博客将为您提供相同的示例:要结合克服此类Web应用程序问题所需的所有功能,您只需使用此库即可 如果您正在寻找快速修复:
$( document ).on("click","a",function( event ){
if($( event.target ).attr( "href" )){
var str = $( event.target ).attr( "href" );
var patt = /^#/g;
var match = str.match(patt);
// Stop the default behavior of the browser,ie to change the URL of the page.
event.preventDefault();
// Manually change the location of the page to stay in "Standalone" mode
// and change the URL at the same time.
location.href = $( event.target ).attr( "href" );
);
这将处理所有锚定标签。。可以使用“match”变量排除具有“#”值的HREF
这个博客会给你同样的例子:你能给我们看一些代码吗?您是如何在web视图中打开index.html的,以及您的代码中实现了哪些代理消息(如果有的话)?您好,Andrey,这是一个在Safari中运行的纯web页面,而不是本机应用程序中的UIWebView。您能给我们展示一些代码吗?如何在web视图中打开index.html,以及在代码中实现了哪些代理消息(如果有的话)?嗨,Andrey,这是一个在Safari中运行的纯web页面,而不是本机应用程序中的UIWebView。这将破坏jquery_ujs之类的东西。很多应用程序都依赖于它来提供注销功能。(例如,jquery_ujs在链接上使用data method=“delete”发送HTTP删除请求)这将破坏像jquery_ujs这样的东西。很多应用程序都依赖于它来提供注销功能。(例如,jquery_ujs在链接上使用data method=“delete”发送HTTP删除请求)