页面加载后页面标题切换为 Url?
Page title switches to Url once page loads?
我有两个 Flutter web 项目:
myurl.com
和 business.myurl.com
我在两个文件中都添加了图标,现在商业网站的标题从应有的标题更改为页面加载后的 URL。我检查了每个字符以寻找 html 文件中的差异,但我找不到任何错误。任何帮助将不胜感激!
调试模式和在线托管时都会出现此问题。
这里是 index.html
有问题的商业网站:
<head>
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="My description here.">
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="My Title">
<link rel="apple-touch-icon" href="favicon.ico">
<!-- Favicon -->
<link rel="icon" type="image/ico" href="favicon.ico"/>
<title>My Title</title>
<link rel="manifest" href="manifest.json">
</head>
我还应该注意,就在这个错误之前,我不小心删除了我的项目 web
文件夹(而不是图标),然后我从回收站恢复了它,一切似乎都是一样的。 flutter doctor
显示未发现问题。
编辑:
当我从主页导航时,它会将页面标题切换为标题应该是什么,如果我弹出主页,标题仍然是正确的。只有页面的第一次初始加载显示 URL 作为标题,直到发生一些导航
经过几个小时的尝试,我找不到这种行为的任何充分理由,我猜测这是 Flutter web 的一个错误。
无论如何,这里有一个解决方法,可以在标题更改为 URL 后再次设置标题:
(import 'package:flutter/services.dart';
)
SystemChrome.setApplicationSwitcherDescription(ApplicationSwitcherDescription(
label: 'MyTitle',
primaryColor: Theme.of(context).primaryColor.value,
));
我有两个 Flutter web 项目:
myurl.com
和 business.myurl.com
我在两个文件中都添加了图标,现在商业网站的标题从应有的标题更改为页面加载后的 URL。我检查了每个字符以寻找 html 文件中的差异,但我找不到任何错误。任何帮助将不胜感激!
调试模式和在线托管时都会出现此问题。
这里是 index.html
有问题的商业网站:
<head>
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="My description here.">
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="My Title">
<link rel="apple-touch-icon" href="favicon.ico">
<!-- Favicon -->
<link rel="icon" type="image/ico" href="favicon.ico"/>
<title>My Title</title>
<link rel="manifest" href="manifest.json">
</head>
我还应该注意,就在这个错误之前,我不小心删除了我的项目 web
文件夹(而不是图标),然后我从回收站恢复了它,一切似乎都是一样的。 flutter doctor
显示未发现问题。
编辑: 当我从主页导航时,它会将页面标题切换为标题应该是什么,如果我弹出主页,标题仍然是正确的。只有页面的第一次初始加载显示 URL 作为标题,直到发生一些导航
经过几个小时的尝试,我找不到这种行为的任何充分理由,我猜测这是 Flutter web 的一个错误。
无论如何,这里有一个解决方法,可以在标题更改为 URL 后再次设置标题:
(import 'package:flutter/services.dart';
)
SystemChrome.setApplicationSwitcherDescription(ApplicationSwitcherDescription(
label: 'MyTitle',
primaryColor: Theme.of(context).primaryColor.value,
));