在推出新的网站更改或 Web 应用程序更改时,有时浏览器会在您导航到该站点时加载旧的 javascript 或图像文件。通常,浏览器需要手动刷新页面才能加载新更新的文件。
如何确保更新后,用户在第一次加载页面时收到最新的文件,而不必手动刷新以清除任何缓存文件。是否有一种非常可靠的方法可以通过发送过期标头或上次修改来做到这一点?
让我解释一下我的设置。我有多个域名,它们都是主域名的 CNAME 记录,例如 example.com。
example.com -> 服务器IP
company1.example.com -> example.com
company2.example.com -> example.com
我基本上正在开发我们软件的白标版本,该软件只是检测引荐来源网址并知道要加载哪些徽标和样式表资源。
所以这一切都很好,但是当 socket.io 尝试与它的 url 握手时,它看起来像http://company1.example.com/socket.io/1/?key=123456,请求会挂起在待处理状态登录应用程序时注明。在主域 example.com 上,一切都进展顺利。不同之处在于,主域将 cookie 发送到 socket.io 握手 URL,而公司子域则不然。
有人对如何解决这个问题有任何想法吗?它似乎甚至没有到达服务器,几分钟后,待处理的请求返回它无法完成。
我的应用程序有一个登录表单,包括用户名,密码和单击登录按钮.但是,由于某种原因,我无法开始ui-keypress登录按钮.我正在使用ui-bootstrap和ui-utils.ui-utils有keypress指令包括在内.
这是我到目前为止所拥有的:
我的登录部分:
<div id="loginForm">
<img id="logo" src="img/login_logo.png"/>
<alert ng-repeat="alert in alerts" type="alert.type" close="closeAlert($index)">
{{alert.msg}}
</alert>
<input type="text" id="username" ng-model="username" placeholder="Username"/>
<input type="password" id="password" ng-model="password" placeholder="Password"/>
<button type="button" id="loginBtn" class="btn btn-primary" ng-model="loginModel" ng-click="login()" ui-keypress="{13:'keypressLogin($event)'}">
Login
</button>
</div>
Run Code Online (Sandbox Code Playgroud)
我的登录控制器:
ClutchControllers.controller("LoginController", [
'$scope',
'$http',
'$location',
'$cookieStore',
'Auth',
function($scope, $http, $location, $cookieStore, Auth) {
// Redirect if already logged in
if(Auth.isLoggedIn()) {
$location.path('/dashboard');
}
$scope.alerts = [];
$scope.closeAlert = function(index) {
$scope.alerts.splice(index, 1);
}
$scope.login …Run Code Online (Sandbox Code Playgroud)