首页 \ 问答 \ 移动的元标签 - 应该使用吗?(Meta-tags for mobile – should they be used?)

移动的元标签 - 应该使用吗?(Meta-tags for mobile – should they be used?)

Meta标签“Viewport”,“MobileOptimized”和“HandheldFriendly”可用于向移动设备提供适当格式的HTML内容。 这些标签是好东西吗? 它们在许多情况下看起来很平坦,即使不是特定平台(viewport),它们似乎需要特定于设备的属性才能正常工作。

应该用吗 何时何地使用它们? 有没有替代方案(没有用户代理识别)?

注意:我一直在使用CSS媒体查询来实现移动支持,但这需要一些UAR才能获得优化的字体大小。


Meta-tags "Viewport", "MobileOptimized" and "HandheldFriendly" can be used to provide appropriately formatted HTML-content to mobile devices. Are these tags good things? They seem pretty platform specific in many cases, and even when not platform specific (viewport), they seem to require device specific attributes in order to work properly.

Should they be used? Where and when is it appropriate to use them? Are there alternatives (without user-agent recognition)?

Note: I have been using CSS media queries to achieve mobile-support, but this requires some UAR in order to get optimize font size.


原文:https://stackoverflow.com/questions/1988499
更新时间:2023-06-22 20:06

最满意答案

全局变量是不良实践的代名词,我认为你不能让它变得更好

我也认为这个问题是基于意见的。

无论如何

为什么你不这样做

你可以创建一个新的控制器让我们说BaseController

BaseController extends Controller {

    protected $hodor;

    public function __construct()
    {
        $hodor = 'HOLD THE FREAKIN DOOR';
    }

}

然后在你的其他控制器中你可以做到这一点

MyOtherController extends BaseController {

    public function hodor()
    {
        echo "today: $this->hodor";
    }

}

但正如我所说,全局变量被认为是不良做法所以我认为你应该使用会话

我认为你可以使用配置文件.env


global variable is a synonym for bad practice , i think you can't make it better

i also think that this question is opinion based.

anyway

why you dont do this

you can create a new controller lets say BaseController

BaseController extends Controller {

    protected $hodor;

    public function __construct()
    {
        $hodor = 'HOLD THE FREAKIN DOOR';
    }

}

Then in your other controllers you can do this

MyOtherController extends BaseController {

    public function hodor()
    {
        echo "today: $this->hodor";
    }

}

But as i said Global variables are considered as bad practices so i think You should use sessions

i think you can use a config file or .env

相关问答

更多
  • 你可以试试看吗? try { $site_title = Options::where('option_name','site_title')->first(); $site_options['site_title'] = $site_title->option_value; } catch (\Exception $e) { $site_options['site_title'] = 'Site Title'; } Can you use a try catch on it? t ...
  • 我不会说你永远不应该使用全局变量,但是: 永远不要使用单身。 这是为什么。 它们很可怕,而且比普通的旧环境要糟糕得多。 “经理”班不好。 他们“管理”什么? 他们如何“管理”它? “经理”类需要被分解成你可以描述的东西。 一旦你找出了“管理”一个对象意味着什么,你可以定义一个或多个具有更好定义职责的对象。 当你使用全局变量时,不要让它们变为可变的。 一个只写全局是可以接受的(考虑一个记录器,你写它,但它的状态永远不会影响应用程序),并且只读全局变量也可以(考虑各种常量永远不会改变,但你经常需要阅读)。 全局 ...
  • 使用局部变量或结构(更易读和更模块化)。 请注意,您可以将它们作为g_timeout_add_seconds的客户端数据传递,例如作为某个struct的地址。 所以更喜欢第一个版本到第二个版本。 但是,你应该使用calloc初始化data ,然后在Glib事件循环之后free它。 Use local variables or structures (more readable and more modular). Notice that you could pass them, e.g. as the ad ...
  • 全局变量是不良实践的代名词,我认为你不能让它变得更好 我也认为这个问题是基于意见的。 无论如何 为什么你不这样做 你可以创建一个新的控制器让我们说BaseController BaseController extends Controller { protected $hodor; public function __construct() { $hodor = 'HOLD THE FREAKIN DOOR'; } } 然后在你的其他控制器中你可以做到 ...
  • 如果你想简单地访问一个全局变量,你只需要使用它的名字。 但是,要更改其值,您需要使用global关键字。 例如 global someVar someVar = 55 这将会将全局变量的值更改为55.否则,它将仅将55分配给局部变量。 函数定义列表的顺序并不重要(假设它们不以某种方式相互引用),它们被调用的顺序是。 If you want to simply access a global variable you just use its name. However to change its valu ...
  • 如果您要在一个模型中使用这些变量,请执行以下操作: protected $firstDayThisYear; public function __construct(array $attributes = []) { parent::__construct($attributes); $this->firstDayThisYear = Carbon::create(date('Y'), 1, 1, 0); } 然后使用$this->firstDayThisYear 。 此外,你可以获得 ...
  • 您可以尝试查看编辑器,以便全局共享所有视图的数据。 public function compose(View $view) { //get value from database $options = Model::where('domain_name', \Request::server("SERVER_NAME"))->get(); //render to view $view->with('options', $options); } $options变量(模型)将在 ...
  • 在构造函数中设置变量。 function _construct() { $this->global = "some value";} 所以,你不仅需要一个全局变量,你也希望这个变量也应该被其他路由改变。 实现这一点的一个方法是使用会话。 function a() { session()->put('global_variable', 'set by method a'); //your other logic } 并从方法b ... function b() { //get t ...
  • 您可以利用每个节点安排到自己的周期性消息。 把它放在initialize()的最后阶段就可以了。 您可以按照以下方式进行操作: void initialize(int stage) { if (stage == 3) { cMessage *pMsg = new cMessage("myPeriodicMessage"); scheduleAt(simTime()+1.0, pMsg); } } 然后在handleMessage()有: void h ...
  • 将它们设置为null或undefined会实现您正在寻找的内容吗? id_p = null; id_c = null; Would setting them to null or undefined accomplish what you're looking for? id_p = null; id_c = null;

相关文章

更多

最新问答

更多
  • h2元素推动其他h2和div。(h2 element pushing other h2 and div down. two divs, two headers, and they're wrapped within a parent div)
  • 创建一个功能(Create a function)
  • 我投了份简历,是电脑编程方面的学徒,面试时说要培训三个月,前面
  • PDO语句不显示获取的结果(PDOstatement not displaying fetched results)
  • Qt冻结循环的原因?(Qt freezing cause of the loop?)
  • TableView重复youtube-api结果(TableView Repeating youtube-api result)
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • SQL Server 2014版本支持的最大数据库数(Maximum number of databases supported by SQL Server 2014 editions)
  • 我如何获得DynamicJasper 3.1.2(或更高版本)的Maven仓库?(How do I get the maven repository for DynamicJasper 3.1.2 (or higher)?)
  • 以编程方式创建UITableView(Creating a UITableView Programmatically)
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何防止调用冗余函数的postgres视图(how to prevent postgres views calling redundant functions)
  • Sql Server在欧洲获取当前日期时间(Sql Server get current date time in Europe)
  • 设置kotlin扩展名(Setting a kotlin extension)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 如何在vim中启用python3?(How to enable python3 in vim?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • dedecms如何安装?
  • 在哪儿学计算机最好?
  • 学php哪个的书 最好,本人菜鸟
  • 触摸时不要突出显示表格视图行(Do not highlight table view row when touched)
  • 如何覆盖错误堆栈getter(How to override Error stack getter)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • USSD INTERFACE - > java web应用程序通信(USSD INTERFACE -> java web app communication)
  • 电脑高中毕业学习去哪里培训
  • 正则表达式验证SMTP响应(Regex to validate SMTP Responses)