通过表单发送屏幕分辨率 [英] Sending screen resolution via a form

查看:83
本文介绍了通过表单发送屏幕分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < input type ='hidden'name ='user -agent'value ='<?php echo $ _SERVER ['HTTP_USER_AGENT']; >'/>< input type =submitvalue =发送用户代理/> 

我已经完成了我的研究,并且有一些代码可能无法正常工作。这是其他人有问题自己寻求帮助。



如何使用PHP表单发送屏幕分辨率?

你将无法从服务器获得屏幕分辨率恕我直言...你可以让表单呈现,然后使用javascript来更新表单输入与正确的信息



HTML

 < input id =browser-resolutiontype =hidden name =resolutionvalue => 

之后作为脚本

 <脚本> 
document.getElementById('browser-resolution')。value = screen.width +x+ screen.height;
< / script>

编辑:加入 fiffle


I've got it sending the user agent already:

<input type='hidden' name='user-agent' value='<?php echo $_SERVER['HTTP_USER_AGENT']; ?>'/><input type="submit" value="Send User Agent" />

I've done my research and there is some code out there that sadly doesn't work. It's other people with problems asking for help themselves.

How can I go about sending screen resolutions using php forms?

解决方案

you will not get the screen resolution from the server IMHO... you could let the form be rendered and then use javascript to update a form input with the correct information

HTML

<input id="browser-resolution" type="hidden" name="resolution" value="">

and afterwards as a script

<script>
  document.getElementById('browser-resolution').value = screen.width + "x" + screen.height;
</script>

EDIT: added fiffle

这篇关于通过表单发送屏幕分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆