javascript - JQuery 移动对话框错误 SecurityError : The operation is insecure

标签 javascript jquery html cordova jquery-mobile

我使用 HTML 和 JQuery mobile 进行phonegap,但是当我使用此代码测试它时,它显示错误 SecurityError: 该操作不安全。 换页功能运行良好,为什么会发生这种情况?

$.mobile.changePage( "#confirm", { 
        role: "dialog"
})

这是我在index.html 文件中的对话框HTML

<div data-role="page" id="confirm">
      <div data-role="header" id="header">
        <div class="header">
            <div class="header-logo"></div>
        </div>
        <div class="header-bottom"></div>           
      </div>

      <div data-role="content" class="ui-content" id="logedin-view">
            <div class="border-logedin">
                <center><h3>Title Loged in Main</h3></center>
            </div>              
            <form id="codesend">
                <input type="text" id="code" class="input" placeholder="Code" required/>
            </form>
            <center>
                <button type="submit" form="codesend" id="code-send" class="input btn-submit" value="submit" data-role="none">Submit</button>
            </center>
            <a href="#index" class="ui-btn ui-corner-all ui-shadow ui-btn-inline ui-btn-b ui-icon-back ui-btn-icon-left" data-rel="back">Go Back</a>
      </div>

      <div class="footer" data-role="footer">
      </div>
    </div> 

最佳答案

在这种情况下,问题出在这一行:

window.history.replaceState( state, state.title || document.title, href );

(在版本1.4.5第2954行)

我不确定它的作用,但是在注释掉它之后,我的代码起作用了。

关于javascript - JQuery 移动对话框错误 SecurityError : The operation is insecure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31914634/

相关文章:

javascript - 创建一行水平排列的 div。我的代码有什么问题?

javascript - 从表单操作调用js函数,然后从js调用php

javascript - 打开对话框后如何返回主视图?

Javascript html5数据库循环事务问题

javascript - jQuery fadeIn() 未达到完全不透明

javascript - Node js中解析编辑并保存js文件

javascript - Google App Script HTML 表格样式

javascript - Tampermonkey:在动态 AJAX 页面上按下按钮时复制源代码

javascript - 从本地驱动器建立 API 连接

php - 如何在同一行上回显一些输出(单选按钮)