草庐IT

READ_HISTORY_BOOKMARKS

全部标签

javascript - 在 history.js 中强制回退 html4

我无法让html4Mode选项为我工作。我在一个非常简单的两页应用程序上使用ajaxify脚本(https://github.com/browserstate/ajaxify)。在支持html5的浏览器中一切正常,但如果我想出于测试目的强制使用html4回退,没有任何变化,似乎历史忽略了这些选项并继续使用html5推送状态url。为了强制回退,我只是更改了ajaxify脚本添加(在DOM上准备好):History.options.html4Mode=true;(我正在使用v1.8b1jqueryhtml4+5捆绑脚本)有没有办法让它工作? 最佳答案

javascript - AngularJS 未知类型错误 : Cannot Read Property '1' Of Null

下面是我遇到问题的代码://MainCodesfortheDiaryApp(function(){//Createanewdiaryappvardiary=angular.module('diary',['ngRoute']);//DefineaRouterfortheAppdiary.config(function($routeProvider){$routeProvider.when('/',{templateUrl:'partials/wall.php',controller:'DiaryWallController'}).when('/images',{templateUrl:

javascript - 防止 react-router history.push 重新加载当前路由

我正在使用react-router迈出我的第一步。我目前正在使用hashHistory进行开发,并且我正在执行“手动”导航。也就是说,我不使用Link,而是调用history.push('/some/route');为了导航(响应对anchor标签的普通点击)。我注意到的是,即使我已经在目标路线上,react-router也会在每次history.push('/target/route');被调用:在每个push('/target/route')上:URL的片段部分仍然是#/target/routeURL的查询字符串部分更改为?_k=somethingRandom目标组件重新渲染我希望

javascript - Requirejs + Backbone 未捕获类型错误 : Cannot read property 'Model' of undefined

我从Backbone开始。我使用Require来加载模块并得到了这个错误。谁能解释一下?在文件user.js中,当我尝试创建Backbone.Model.extend时出现此错误。我使用了Backbone.js0.9.10、jQueryv1.9.0、RequireJS2.1.4、Underscore1.4.4。谢谢。index.html主要.jsrequire.config({paths:{jquery:'libs/jquery/jquery-min',underscore:'libs/underscore/underscore-min',backbone:'libs/backbone

javascript - Backbone.js 集合 fetch() 抛出未捕获的类型错误 : Cannot read property 'idAttribute' of undefined

我正在努力学习Backbone.js它可以获取、放置和删除单个模型。但是,当我创建一个集合时,fetch方法给出了这个错误:未捕获的类型错误:无法读取未定义的属性“idAttribute”(backbone.js:683)这是我正在尝试的代码:Person=Backbone.Model.extend({urlRoot:'/people'});PersonList=Backbone.Collection.extend({model:'Person',url:'/people'});varpersonList=newPersonList();personList.fetch();在获取时,

javascript - 谷歌地图未捕获类型错误 : Cannot read property 'LatLng' of undefined

我不断收到此错误“未捕获的类型错误:无法读取未定义的属性‘LatLng’”尝试创建map时在头部:................functioninit(){varlatlng=newgoogle.maps.LatLng(-43.552965,172.47315);varmyOptions={zoom:10,center:latlng,mapTypeId:google.maps.MapTypeId.ROADMAP};map=newgoogle.maps.Map(document.getElementById("map"),myOptions);}................

javascript - Fabric.js 子类化 fabric.Group - 错误 : "Cannot read property ' async' of undefined"when load from JSON

有以下问题:尝试继承fabric.Group:varCustomGroup=fabric.util.createClass(fabric.Group,{type:'customGroup',initialize:function(objects,options){options||(options={});this.callSuper('initialize',objects,options);this.set('customAttribute',options.customAttribute||'undefinedCustomAttribute');},toObject:functi

javascript - 未捕获的类型错误 : Cannot read property 'toUpperCase' of undefined react state item

我是React和Javascript的新手,我正在尝试呈现以下React组件:'usestrict';varReact=require('react');importToReadListfrom'./toreadlist.js';varToRead=React.createClass({getInitialState:function(){return{bookTitles:[]};},handleSubmit:function(e){e.preventDefault();this.state.bookTitles.push(React.findDOMNode(this.refs.bo

javascript - this.props.history 已弃用( react 路由器)

我试图以编程方式导航到另一个页面,就像这样this.props.history.push('/new-path');它有效,但我在控制台中收到弃用警告说:警告:[react-router]props.history和context.history已弃用。请使用context.router。此处有更多信息https://github.com/reactjs/react-router/blob/master/upgrade-guides/v2.0.0.md#changes-to-thiscontext之后我尝试像这样使用这个新方法this.context.router.push('/new

javascript - 通过 history.pushState 更改页面时如何在 google chrome 扩展程序中插入内容脚本?

我正在为网站创建一个小的googlechrome扩展,我想更改特定页面上的一些html。问题是网站通过ajax加载他的内容,并大量使用history.pushStateAPI。所以,我添加了这个东西来体现:"content_scripts":[{"matches":["http://vk.com/friends"],"js":["js/lib/jquery.min.js","js/friends.js"],},]当我第一次打开页面或重新加载它时一切正常。但是当我在网站页面之间导航时,chrome不会在“/friend”页面上插入我的脚本。我认为发生这种情况是因为URL实际上没有改变。他