我有4种状态:dashboard,dahboard.main,dashboard.minor,login.仪表板是抽象的,它是.minor和.main状态的父状态.以下是我的代码:
.state('dashboard', {
url: "/dashboard",
abstract: true,
templateUrl: "views/dashboard.html",
resolve: {
auth: function ($q, authenticationSvc) {
var userInfo = authenticationSvc.getUserInfo();
if (userInfo) {
return $q.when(userInfo);
} else {
return $q.reject({ authenticated: false });
}
}
},
controller: "DashboardCtrl",
data: { pageTitle: 'Example view' }
})
.state('dashboard.main', {
url: "",
templateUrl: "views/main.html",
controller: "DashboardCtrl",
data: { pageTitle: 'Main view' }
})
Run Code Online (Sandbox Code Playgroud)
正如您在仪表板状态中看到的,我有解决方案选项.如果他没有被授权,我想将用户重定向到登录页面.出于这个原因,我使用特殊的authenticationSvc服务:
.factory("authenticationSvc", ["$http", "$q", "$window", function ($http, $q, $window) { …Run Code Online (Sandbox Code Playgroud) 我想在我的网页上显示网络摄像头的图像,但图像位于HTTP基本认证服务器后面.
在Firefox和Chrome中,我可以这样做:
<img width="320" height="200" src="http://username:password@server/Path" />
Run Code Online (Sandbox Code Playgroud)
但在Internet Explorer 8中,我得到一个空的图像框.如果我使用JQuery设置src属性,IE8会显示一个空白的src.看起来IE8正在检查字符串并拒绝它.
有没有办法将基本身份验证凭据放在img标记中?
我有一个链接http://uuuu.com/index.jsp?username=user&password=pass.如果用户点击该链接,则应该自动登录该网站,并从该网址读取用户名和密码.因此用户无需填写用户名字段和密码字段即可查看该站点.网址格式是否正确?如果不正确的格式是什么?