iOS Safari "Add to home screen" 问题
iOS Safari "Add to home screen" issue
我有一个网络应用程序,使用这个元数据:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
此应用程序是基于网络的 php Silex/Symfony,启动时有一个登录会话。
我的 iPad 上有我的图标,但每次我打开我的应用程序时,safari 总是重新加载登录页面,即使我之前登录过。
谁能帮我解决这个问题?
// Register routes
$app->get('/', 'index.controller:indexAction')->bind('index')->value('require_authentication', true);
$app->get('/login', 'auth.controller:loginAction')->bind('login');
$app->get('/logout', 'auth.controller:logoutAction')->bind('logout');
$app->post('/auth', 'auth.controller:authAction')->bind('auth');
....
//before stack - check for user login, if not throw AccessDeniedHttpException
$app->before(function(Request $request, Application $app) {
if ($app['request']->get('require_authentication')) {
if (null === $user = $app['session']->get('user')) {
throw new AccessDeniedHttpException("require auth");
}else{
$app["twig"]->addGlobal("user", $user);
}
}
});
此网络应用程序将仅在 iPad 上使用,因此不需要每个设备的识别代码。
/
的路由将捕获所有请求,因此您需要 reorder them such that more specific route paths are not caught be less specific ones:
The order in which the routes are defined is significant. The first matching route will be used, so place more generic routes at the bottom.
这意味着您的代码应如下所示:
// Register Routes
$app->get('/login', 'auth.controller:loginAction')->bind('login');
$app->get('/logout', 'auth.controller:logoutAction')->bind('logout');
$app->post('/auth', 'auth.controller:authAction')->bind('auth');
$app->get('/', 'index.controller:indexAction')->bind('index')->value('require_authentication', true);
我有一个网络应用程序,使用这个元数据:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
此应用程序是基于网络的 php Silex/Symfony,启动时有一个登录会话。
我的 iPad 上有我的图标,但每次我打开我的应用程序时,safari 总是重新加载登录页面,即使我之前登录过。
谁能帮我解决这个问题?
// Register routes
$app->get('/', 'index.controller:indexAction')->bind('index')->value('require_authentication', true);
$app->get('/login', 'auth.controller:loginAction')->bind('login');
$app->get('/logout', 'auth.controller:logoutAction')->bind('logout');
$app->post('/auth', 'auth.controller:authAction')->bind('auth');
....
//before stack - check for user login, if not throw AccessDeniedHttpException
$app->before(function(Request $request, Application $app) {
if ($app['request']->get('require_authentication')) {
if (null === $user = $app['session']->get('user')) {
throw new AccessDeniedHttpException("require auth");
}else{
$app["twig"]->addGlobal("user", $user);
}
}
});
此网络应用程序将仅在 iPad 上使用,因此不需要每个设备的识别代码。
/
的路由将捕获所有请求,因此您需要 reorder them such that more specific route paths are not caught be less specific ones:
The order in which the routes are defined is significant. The first matching route will be used, so place more generic routes at the bottom.
这意味着您的代码应如下所示:
// Register Routes
$app->get('/login', 'auth.controller:loginAction')->bind('login');
$app->get('/logout', 'auth.controller:logoutAction')->bind('logout');
$app->post('/auth', 'auth.controller:authAction')->bind('auth');
$app->get('/', 'index.controller:indexAction')->bind('index')->value('require_authentication', true);