草庐IT

user-location

全部标签

javascript - 为什么 location.reload() 比其他页面重新加载方法慢?

几个月前我发布了thisanswer关于如何通过JavaScript刷新页面。我提供了一个JSFIDDLEDEMO也是:varsolutions=[function(){location.reload();},function(){history.go(0);},function(){location.href=location.href;},function(){location.href=location.pathname;},function(){location.replace(location.pathname);},function(){location.reload(fa

javascript - 如何防止 window.location.pathname 转义 URL 中的字符

我正在开发一个谷歌应用引擎应用程序。单击按钮时,我试图将用户重定向到登录页面。为此,我将window.location.pathname设置为以下字符串/_ah/login?continue=http%3A//localhost%3A8080/。但是,chrome对该字符串进行了转义,以便完整的URL变为http://localhost:8080/_ah/login%3Fcontinue=http%3A//localhost%3A8080/,这会产生404错误。我怎样才能防止这种情况发生?有效的URL是http://localhost:8080/_ah/login?continue=h

javascript - 在 PhoneGap 中调用 window.location.href 触发网络浏览器

你好我正在尝试使用PhoneGap为iPad开发应用程序。我想在index.html页面内动态加载外部网站的主页。不幸的是使用window.location.href="http://mywebsite.com/cgi-bin/index.py"触发Safari窗口的打开而不是使用PhoneGap容器。有什么建议吗?非常感谢子句 最佳答案 还有一个更简单的选择:修改config.xmlOpenalllinksinWebViewstay-in-webviewwithvaluestrueorfalseexample:ifsettotru

javascript - 在 Opera User JavaScript 中使用 jQuery

我想知道是否可以在OperaUserJavaScript内加载jQuery,这样我就可以在其中使用jQuery功能,即使在当前未使用jQuery的页面上也是如此。 最佳答案 我刚刚编写了一个OperauserJS,它是我从GoogleChrome扩展程序转换而来的,可以轻松加载jQuery,但在Opera中我不得不使用另一种解决方案,并且我想对我的代码进行最少的更改。我只是在文档的header中附加了一个新的脚本标记,其中包含一个有效的jQuery源代码。它会在DOM准备就绪之前开始下载。这是我的工作解决方案,希望对您有所帮助!//

javascript - angularjs + ui 路由器 : redirect to login page when user is not logged in on each state change

我正在使用angularjs和ui-router构建一个简单的博客应用程序,我想监听每个状态变化并检查用户是否已登录。如果他没有登录,我想将他重定向到登录页面。场景非常简单,我试图实现thissolution没有运气。这是相关代码:app.config(function($stateProvider,$urlRouterProvider){$stateProvider.state('app',{url:'',abstract:true});$urlRouterProvider.otherwise('blogs');});app.run(function($rootScope,$stat

javascript - AngularJS $location.path() 不重新加载目标 View 的数据

在我的Angular项目中,当使用$location.path('/foobar')更改路径时,会显示目标View但不会重新加载数据(通常在保存项目并继续返回列表,列表未更新)。我尝试添加$route.reload()或$scope.apply(),但没有任何变化。我不知道做这项工作有什么问题或缺失。更新$location.url()也不起作用我使用的是angular1.2.26更新2-答案好了,经过大量的评论和回答,我想是时候结束了。我没想到这会是一个如此复杂的问题。所以,我的结论是:给出@yvesmancera的简单示例,Controller的默认行为是重新加载自身在具有资源工厂和

go - 构建时在 golang 中找不到包 "github.com/user../../"

我正在尝试从github源代码构建一个项目。我发现一些源代码导入了如下所示的包:import("os""github.com/bivas/rivi/commands""github.com/mitchellh/cli")但是在构建项目时每次都会报错:user-MacBook-Pro:riviuser$gobuildrivi.gorivi.go:6:2:cannotfindpackage"github.com/bivas/rivi/commands"inanyof:/usr/local/Cellar/go/1.7.5/libexec/src/github.com/bivas/rivi/c

user-interface - 从一组代码同时打开 2 个相同的窗口

我正在使用以下代码创建并显示一个窗口,其中包含GUI组件作为标签、条目和按钮://modifiedfrom:https://github.com/andlabs/ui/wiki/Getting-Startedpackagemainimport("github.com/andlabs/ui")funcmakewinfn(){varname=ui.NewEntry()varbutton=ui.NewButton("Greet")vargreeting=ui.NewLabel("")box:=ui.NewVerticalBox()box.Append(ui.NewLabel("Enteryo

user-interface - 为什么找不到来自 andlabs/ui 包的组件

我正在尝试按照简单的代码(修改自here)来创建一个窗口:packagemainimport("github.com/andlabs/ui")funcmain(){ui.Main(makeMainWin)}funcmakeMainWin(){varbmiButton=ui.NewButton("First")varotherButton=ui.NewButton("Second")//ui.NewVerticalStackdoesnotwork;stack:=ui.NewVerticalStack(ui.NewLabel("Selectmodule"),bmiButton,otherB

user-interface - 如何声明一个ui.NewEntry数组?

我正在尝试创建一个带有一系列文本输入字段的GUI:packagemainimport("github.com/andlabs/ui")funcmain(){ui.Main(makeMainWin)}funcmakeMainWin(){varentlist=[]ui.NewEntry//Errorhere.Howtodeclareanarrayofui.NewEntry?varbox=ui.NewVerticalBox()fori,_:=range[5]int{}{println(i)box.Append(ui.NewEntry(),false)}varmainWindow=ui.New