热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

GWT模块XML-如何重新定义和使用多个用户代理-GWTmoduleXML-howtoredefineandusemorethanoneuseragent

http:code.google.comdocreader#pgoogle-web-toolkit-doc-1-5&sgoogle-web-toolkit-doc-1-5&

http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=FAQ_CompileOnePermutation

In the article I learned I can speed up the compiler but specifying the target user agent. The problem how can I specify more than one user agent? Suppose my application supports ie6 and FF3

在我学到的文章中,我可以加速编译器,但指定目标用户代理。问题如何指定多个用户代理?假设我的应用程序支持ie6和FF3


doesn't work - I got XML parsing error:

不起作用 - 我得到XML解析错误:

[ERROR] Invalid property value 'ie6,gecko1_8'

I'm wondering if there's a way to specify more than one specific user agent in the module XML file?

我想知道是否有办法在模块XML文件中指定多个特定用户代理?

5 个解决方案

#1


I've had a similar error message, when setting the user.agent value to gecko in GWT2.4. So I looked around and found where the gwt code defines the possible values.

在GWT2.4中将user.agent值设置为gecko时,我遇到了类似的错误消息。所以我环顾四周,发现gwt代码定义了可能的值。

If you look in the gwt-user.jar at com.google.gwt.user.UserAgent.gwt.xml you can see the possible values for the version of GWT you are using.

如果您查看com.google.gwt.user.UserAgent.gwt.xml中的gwt-user.jar,您可以看到您正在使用的GWT版本的可能值。

For GWT2.4, this is what i found:

对于GWT2.4,这是我发现的:


  
  
  
  
  
  
  

Therefore gecko is not a valid value for user.agent in my case, and if I use gecko1_8 it compiles for Firefox fine.

因此,在我的情况下,gecko不是user.agent的有效值,如果我使用gecko1_8,它可以很好地编译Firefox。

#2


Works in GWT 1.6, your *.gwt.xml file :

适用于GWT 1.6,您的* .gwt.xml文件:


      
      
      

#3


for webkit based browsers like chrome, use "safari" as the user agent

对于像chrome这样的基于webkit的浏览器,使用“safari”作为用户代理

#4


In order to rapidly deploy any application, you'll need two targets; once for the engine your hosted mode deploys on {Firefox / Linux, Safari / Mac, IE6 / Win}, and one for your agile browser that lets you build css in real-time {Firefox + Firebug}.

为了快速部署任何应用程序,您需要两个目标;一次用于引擎,您的托管模式部署在{Firefox / Linux,Safari / Mac,IE6 / Win}上,一个用于您的敏捷浏览器,可以让您实时构建css {Firefox + Firebug}。

Linux: 
Mac: 
...etc...

This is GWT >= 1.6 ONLY!

这只是GWT> = 1.6!

For older gwt projects, you must super-source the com/google/gwt/user/UserAgent.gwt.xml file... Put it in a source location that is included BEFORE your gwt-*.jar on the classpath. Basically, you can copy that file into a new one in the same package as the original, and edit the CDATA Javascript block that returns the actual user.agent value. Play with this all you like, but don't go getting too crazy with their user.agent property, as it WILL be changing for ie8 in a future build.

对于较旧的gwt项目,您必须超级com / google / gwt / user / UserAgent.gwt.xml文件...将其放在包含在类路径上的gwt - * .jar之前的源位置。基本上,您可以将该文件复制到与原始文件相同的包中的新文件中,并编辑返回实际user.agent值的CDATA Javascript块。玩这个你喜欢的,但不要对他们的user.agent属性过于疯狂,因为它将在未来版本中改变ie8。

To target ie browsers, make up your own ie.version property, and tweak a copy of the property-provider in UserAgent.gwt.xml to target different versions of ie. Just make sure that when you use the custom property for deferred binding you do:

要定位ie浏览器,请构建自己的ie.version属性,并在UserAgent.gwt.xml中调整属性提供程序的副本以定位不同版本的ie。只需确保在使用自定义属性进行延迟绑定时,您可以:


  
  
    
    
  

Or you'll get ie7 + gecko/safari builds and other silly junk that will never be used.

或者你将获得ie7 + gecko / safari构建和其他永远不会被使用的愚蠢垃圾。

Note: Any code in a property-provider is loaded in the .nocache.js, and can be useful to preload images / css whilst the .cache.js payload is being downloaded.
Just add var __cached = new Image('Url To Compiled Image / Whatever you want to load');

注意:属性提供程序中的任何代码都加载到.nocache.js中,对于在下载.cache.js有效内容时预加载images / css非常有用。只需添加var __cached = new Image('Url To Compiled Image / Whatever you to loading');

#5


Not yet. The idea is that you develop rapidly to one browser and then compile once to deploy (i.e., do final testing) for all browsers, with GWT handling the browser differences. Don't forget that at deploy time GWT will optimize the downloads per browser so that in the end it doesn't matter how many user agents you chose.

还没。这个想法是你快速开发到一个浏览器然后编译一次以便为所有浏览器进行部署(即,做最终测试),GWT处理浏览器差异。不要忘记,在部署时,GWT将优化每个浏览器的下载量,以便最终与您选择的用户代理数量无关。


推荐阅读
  • IjustinheritedsomewebpageswhichusesMooTools.IneverusedMooTools.NowIneedtoaddsomef ... [详细]
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • 本文介绍了数据库的存储结构及其重要性,强调了关系数据库范例中将逻辑存储与物理存储分开的必要性。通过逻辑结构和物理结构的分离,可以实现对物理存储的重新组织和数据库的迁移,而应用程序不会察觉到任何更改。文章还展示了Oracle数据库的逻辑结构和物理结构,并介绍了表空间的概念和作用。 ... [详细]
  • 本文详细介绍了Linux中进程控制块PCBtask_struct结构体的结构和作用,包括进程状态、进程号、待处理信号、进程地址空间、调度标志、锁深度、基本时间片、调度策略以及内存管理信息等方面的内容。阅读本文可以更加深入地了解Linux进程管理的原理和机制。 ... [详细]
  • 本文介绍了在Linux下安装Perl的步骤,并提供了一个简单的Perl程序示例。同时,还展示了运行该程序的结果。 ... [详细]
  • 本文介绍了Linux系统中正则表达式的基础知识,包括正则表达式的简介、字符分类、普通字符和元字符的区别,以及在学习过程中需要注意的事项。同时提醒读者要注意正则表达式与通配符的区别,并给出了使用正则表达式时的一些建议。本文适合初学者了解Linux系统中的正则表达式,并提供了学习的参考资料。 ... [详细]
  • FeatureRequestIsyourfeaturerequestrelatedtoaproblem?Please ... [详细]
  • Linux的uucico命令使用方法及工作模式介绍
    本文介绍了Linux的uucico命令的使用方法和工作模式,包括主动模式和附属模式。uucico是用来处理uucp或uux送到队列的文件传输工具,具有操作简单快捷、实用性强的特点。文章还介绍了uucico命令的参数及其说明,包括-c或--quiet、-C或--ifwork、-D或--nodetach、-e或--loop、-f或--force、-i或--stdin、-I--config、-l或--prompt等。通过本文的学习,读者可以更好地掌握Linux的uucico命令的使用方法。 ... [详细]
  • 本文整理了常用的CSS属性及用法,包括背景属性、边框属性、尺寸属性、可伸缩框属性、字体属性和文本属性等,方便开发者查阅和使用。 ... [详细]
  • python+selenium十:基于原生selenium的二次封装fromseleniumimportwebdriverfromselenium.webdriv ... [详细]
  • CSS|网格-行-结束属性原文:https://www.gee ... [详细]
  • this prototype 闭包 总结
    this对象整理下思路:一般用到this中的情景:1.构造方法中functionA(){this.nameyinshen;}varanewA() ... [详细]
  • JavaWeb介绍概念JavaWeb,是用Java技术来解决相关web互联网领域的技术总和。web包括:web服务器和web客户端两部分。Java在客户端的应用有javaapplet,不过使 ... [详细]
  • windows 下git出现警告:warning: LF will be replaced by CRLF in test1.txt. The file will have its original
    windows下git出现警告:warning:LFwillbereplacedbyCRLFintest1.txt.Thefilewillhaveitsorigina ... [详细]
  • 前端~javascript~webAPI/文档对象模型Dom/Dom树/事件机制/操作元素/实战案例:实现网页计数器
    文章目录WebAPI简介DomDom树获取Dom元素事件事件三要素操作dom元素innerHTMLinnerText实战案例:实现网页计数器WebAPI简介什么是AP ... [详细]
author-avatar
于英豪H
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有