首页 \ 问答 \ Titanium:如何在加载WebView时设置referer(Titanium: How to set referer when loading WebView)

Titanium:如何在加载WebView时设置referer(Titanium: How to set referer when loading WebView)

我目前正在使用它

mywebview.setUrl(the_url);

加载URL。

相反,我可以加载它,以便在http标头中包含一个引用程序吗?

编辑:原因是链接到的网站应该能够看到流量来自哪里,即使URL被加载到与包含链接的网页不同的网页视图中。 (我使用多个WebView来创建选项卡UI。)

编辑:xcode等价似乎是这样,虽然我不确定这是否也将它加载到新的webview中: 在嵌入式UIWebView中指定HTTP referer


I currently use this

mywebview.setUrl(the_url);

to load a URL.

Can I, instead, load it in such as way as to include a referer in the http header?

EDIT: The reason for this is that the linked-to website should be able to see where the traffic is coming from even if the URL is loaded into a different webview than the one that contained the link. (I use multiple WebViews to create a tab UI.)

Edit: The xcode equivalent seems to be this, although I'm not sure if this is also loading it into a new webview: Specifying HTTP referer in embedded UIWebView


原文:https://stackoverflow.com/questions/34949926
更新时间:2023-12-20 10:12

最满意答案

所有答案解释为什么你得到2而不是1实际上是错误的。 根据PHP文档,以这种方式混合+++是未定义的行为,所以你可以获得1或2.切换到不同版本的PHP可能会改变你得到的结果,它将是一样有效。

见示例1 ,其中说:

// mixing ++ and + produces undefined behavior
$a = 1;
echo ++$a + $a++; // may print 4 or 5

笔记:

  1. 运算符优先级不能确定评估的顺序。 运算符优先级仅确定表达式$l + ++$l被解析为$l + (++$l) ,但不能确定是否首先计算+运算符的左或右操作数。 如果首先评估左操作数,结果将为0 + 1,如果首先评估右操作数,结果将为1 + 1。

  2. 操作员关联性也不影响评估顺序。 +运算符离开关联性仅确定$a+$b+$c被评估为($a+$b)+$c 。 它不会以什么顺序确定单个操作符的操作数被评估。

另外相关:在关于另一个表达式的错误报告中 ,一个PHP开发人员说:“我们不保证评估顺序[...],就像C不一样,你可以指向在哪里说明首先对第一个操作数进行评估?


All the answers explaining why you get 2 and not 1 are actually wrong. According to the PHP documentation, mixing + and ++ in this manner is undefined behavior, so you could get either 1 or 2. Switching to a different version of PHP may change the result you get, and it would be just as valid.

See example 1, which says:

// mixing ++ and + produces undefined behavior
$a = 1;
echo ++$a + $a++; // may print 4 or 5

Notes:

  1. Operator precedence does not determine the order of evaluation. Operator precedence only determines that the expression $l + ++$l is parsed as $l + (++$l), but doesn't determine if the left or right operand of the + operator is evaluated first. If the left operand is evaluated first, the result would be 0+1, and if the right operand is evaluated first, the result would be 1+1.

  2. Operator associativity also does not determine order of evaluation. That the + operator has left associativity only determines that $a+$b+$c is evaluated as ($a+$b)+$c. It does not determine in what order a single operator's operands are evaluated.

Also relevant: On this bug report regarding another expression with undefined results, a PHP developer says: "We make no guarantee about the order of evaluation [...], just as C doesn't. Can you point to any place on the documentation where it's stated that the first operand is evaluated first?"

相关问答

更多
  • 对于内置类型,您将是正确的:内置的分配运算符需要左侧的可修改的左值 。 但是,这不是使用内置的操作符,而是由类隐式声明的重载。 这是一个成员函数,相当于 A().operator=(A()); 并且可以在rvalue上调用成员函数。 For built-in types, you'd be correct: the built-in assignment operator requires a modifiable lvalue on the left hand side. However, this i ...
  • 所有答案解释为什么你得到2而不是1实际上是错误的。 根据PHP文档,以这种方式混合+和++是未定义的行为,所以你可以获得1或2.切换到不同版本的PHP可能会改变你得到的结果,它将是一样有效。 见示例1 ,其中说: // mixing ++ and + produces undefined behavior $a = 1; echo ++$a + $a++; // may print 4 or 5 笔记: 运算符优先级不能确定评估的顺序。 运算符优先级仅确定表达式$l + ++$l被解析为$l + (++$ ...
  • 该声明 if A: 将调用A.__nonzero__() (请参阅特殊方法名称文档),并使用该函数的返回值。 总结如下: object.__nonzero__(self) 被称为实现真值测试和内置操作bool() ; 应返回False或True ,或其整数等于0或1 。 当没有定义此方法时, __len__() ,如果它被定义,并且如果该对象的结果为非零,该对象将被视为true。 如果一个类不定义__len__()和__nonzero__() ,它的所有实例都被认为是真的。 另一方面, if A is n ...
  • 因为浮点数学不是关联的 。 在浮点乘法中分组操作数的方式对答案的数值精度有影响。 因此,大多数编译器对于重新排序浮点计算非常保守,除非他们可以确定答案将保持不变,否则除非您告诉他们您不在乎数字精度。 例如:gcc 的-fassociative-math选项 ,它允许gcc重新关联浮点运算,甚至可以使用-ffast-math选项,这样可以更准确地反对速度。 Because Floating Point Math is not Associative. The way you group the operand ...
  • 是的 , a*=(a*)*是相同的。 两者都会生成相同的语言,即包含null任何数字a。 L(a*) = {^, a, aa, aa...... } = L ((a*)*) (a*)*是一个有效的表达式吗? 是的,这个表达式叫做REGULAR-EXPRESSION (我看到你错过了标签)。 任何正则语言(RL)都可以用正则表达式(RE)表示。 代表RL的字母表方式。 为什么它是一样的? *表示重复任意次数(包括0次)。 a*表示0 a,1a,2a或任意数量的a。 (a *)*表示任意数量的时间(包括0次)在 ...
  • 我刚试过这个: $a = true; echo ($a == 1 && $a == 2 && $a == 3); 它回应了1 。 由于类型转换而不是类型检查,与布尔值相比,1,2,3将被视为true 。 回答编辑:不,不能做。 @FrankerZ评论的Hackish方法 : 零字节字符= 0xFEFF http://shapecatcher.com/unicode/info/65279 http://www.unicodemap.org/details/0xFEFF/index.html $var  = ...
  • 这不是严格和懒惰之间的区别,而是浮点数语义的产物。 Haskell's Double与C的double或Java或其他大多数语言的语义大致相同。 非常聪明和合格人们已经认识并决定用合适的方式来表示合理的十进制数是二进制的,我们或多或少地坚持它。 所以答案是否定的,因为四舍五入与评估顺序无关。 虽然在这里我们似乎正在讨论GHC用于添加浮点数的primop,但要记住+在Haskell中是可扩展的,只是一个正常的函数。 Num类的新实例没有义务提供关联操作。 作为一个简单的例子,我有一个库让用户在Haskell ...
  • &a是int (*)[2] 。 即指向数组的指针。 但是int *b=&a; 分配给整数指针。 虽然它指向正确的地址,但您需要进行类型转换以删除警告消息。 添加(int*)类的。 int *b=(int*)&a; #include int main() { int a[2] = {10,20}; int *b=(int*)&a; printf("\n :%d %d\n", b[0], b[1]); #if 0 printf("%p\n",a); ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)