jquery mobile 中的 Response.redirect 和 data-rel="back"

Posted

技术标签:

【中文标题】jquery mobile 中的 Response.redirect 和 data-rel="back"【英文标题】:Response.redirect and data-rel="back" in jquery mobile 【发布时间】:2013-04-09 03:28:13 【问题描述】:

我正在使用 asp.net webforms 开发 webapp。 我的问题是当我点击后退按钮时我没有获得历史记录,这是我的代码:

 <div class="header" data-role="header" data-theme="f"  >
        <div>
            <a class="ui-btn-left" data-theme="f" data-role="button" data-corners="true"  data-rel="back"
                class="ui-btn-left ui-btn ui-shadow  ui-btn-up-b ui-btn-corner-all " data-shadow="true" href="#"
                data-iconshadow="true" data-icon="back" data-ajax="true">Back</a> 

                <a class="ui-btn-right btnLogout"
                    href="#" data-theme="f" data-role="button" data-corners="true" id="btnLogout"
                    class="ui-btn ui-shadow  ui-btn-up-b ui-btn-corner-all " data-shadow="true" data-iconshadow="true"
                    onclick="Dologout(); return false;">Logout</a>
        </div>

以上代码在母版页中。我在一个页面中有一些下拉选项,在另一页面上有搜索结果,我正在使用response.redirect() 方法导航搜索结果。 但是当我单击后退按钮时,它会清除所有内容。我想展示历史。我做了

 <script type="text/javascript">
        $(document).bind("mobileinit", function () 
            // jQuery Mobile's Ajax navigation does not work in all cases (e.g.,
            // when navigating from a mobile to a non-mobile page), especially when going back, hence disabling it.
            $.mobile.ajaxEnabled = false;
            $.mobile.ajaxLinksEnabled = false;
            $.mobile.ajaxFormsEnabled = false;
        );

请帮帮我!

【问题讨论】:

你点击back按钮它会清除一切。这是什么意思?您要重定向到哪个页面? 页面有下拉框,包含搜索条件,点击搜索按钮时,它会重定向到结果页面,所以这里是我想从结果页面返回搜索页面的后退按钮。跨度> 【参考方案1】:

问题只出在 Internet Explorer 上。它适用于 FF 和 chrome。我使用会话来保存变量并在单击返回时将值恢复为下拉列表 除了使用会话之外,我没有找到任何其他解决方法。

【讨论】:

以上是关于jquery mobile 中的 Response.redirect 和 data-rel="back"的主要内容,如果未能解决你的问题,请参考以下文章

jQuery Mobile 后退按钮中的图像不出现

在 jQuery Mobile 中的 Ajax 调用中显示页面加载微调器

JQuery Mobile 中的水平布局

jquery mobile中的listview搜索

除非我刷新,否则 jQuery mobile 中的 JavaScript 不起作用

jquery mobile中的谷歌地图