我试图帮助某人在浏览器信息亭浏览器上显示网站时遇到问题。
他们目前有一个网站运行一个基于锂框架的自定义CMS驱动网站,该网站适合他们并满足他们的需求。但是,他们想做的是通过设置触摸屏信息亭来扩展这一点,以便公众可以在访问网站时查看网站,而不是像往常一样通过互联网查看。
问题是,该网站可以在桌面和移动设备上使用,但尝试使用触摸屏具有挑战性,因为一些文本/链接等非常小。我正在寻找的方法是让一台机器以更加实用的方式显示网站。
在测试期间,我开始研究单独的CSS工作表,通过使用更多触摸友好的交互来解决其中的一些问题。它似乎工作正常。
我在苦苦挣扎的是如何让样式表仅应用于该计算机而不是每个连接的人?目前,我已经使用了一些php / javascript来检查请求机器的IP地址,如果它与自助服务终端的IP地址匹配,那么它包含一个单独链接到该部分的触摸友好CSS文件。这样做没问题 - 但是,我不确定这是否实用,并且在野外'。
它将驻留的互联网连接没有静态IP地址,因此我无法保证保持不变。还有其他技巧我可以使用吗?我确实想知道匹配主机名,但据我所知,没有办法获取请求计算机的主机名。
我可以完全访问服务器和自助服务终端。服务器是标准的LAMP设置,Kiosk是一台Windows 8.1机器,带有单个触摸屏(ELO),由riro运行Metro app Kiosk Browser。
答案 0 :(得分:0)
由于您可以使用php并可以访问自助服务终端计算机,因此我会使用仅适用于自助服务终端的配置文件。
创建一个文本文件并将其另存为kiosk.txt。
在kiosk.txt中放置一行文字以检查是否存在。
示例:kiosk
PHP可能看起来像这样放在index.php文件的head部分。
示例PHP:
//get the contents of the kiosk.txt php file
//you will have to use the path that you saved kiosk.txt to below
$kiosk = file_get_contents("kiosk.txt");
//place a check to see if the kiosk.txt file contains the word kiosk
if(strpos($kiosk,"kiosk") !== false){//begin if then else
//echo the path to your css file to load it for the kiosk specifically
//make sure you replace the href value with correct style sheet path below
echo "<link href='http://pathToYourStyleSheet.css' rel='stylesheet'>"
}
else{
//echo the non kiosk stylesheet
}//end if then else
或者你可以将一个http get变量传递给索引文件,这可能会更好,因为你是从另一台计算机而不是自助服务终端提供php。
使加载索引文件的快捷方式或链接看起来像这样:
然后在index.php文件中进行检查以查看kiosk get变量是否为真
//get the kiosk variable value
$kiosk = $_GET["kiosk"];
//check to see if its true
if($kiosk === "true"){//begin if then else
//echo the path to your css file to load it for the kiosk specifically
//make sure you replace the href value with correct style sheet path below
echo "<link href='http://pathToYourStyleSheet.css' rel='stylesheet'>"
}
else{
//echo the non kiosk stylesheet
}//end if then else