dsv768456 2014-12-10 11:02
浏览 39

为特定的自助服务终端计算机使用单独的CSS?

I'm trying to help out someone with a problem getting a website to display well on a touchscreen kiosk browser.

They currently have a website running a custom CMS driven site built on the Lithium framework which works well for them and serves their needs. However, what they would like to do is extend this by having a touchscreen kiosk so that the public can view the website whilst visiting them rather than over the internet as normal.

The problem is, the site is fine to use on a desktop and on a mobile device, but trying to use the touchscreen is challenging, as some of the text / links etc are quite small. What I am looking for is a way of getting that one machine to show the website in a much more usable way.

During testing, I've gone down the route of developing a separate CSS sheet, which solves some of these problems by using much more touch-friendly interactions. It seems to work okay.

Where I am struggling is how do I get the style sheet to apply just to that computer rather than everybody who is connecting? At the moment, I have used some php / javascript to check the IP Address of the requesting machine, and if it matches the ip address of the kiosk, then it includes a separate link to the touch friendly CSS file in the section. That works okay - however, i'm not sure this is practical 'in the wild'.

The internet connection it will reside on doesn't have a static IP address, so I cannot guarantee that remaining the same. Is there another trick I could use? I did wonder about matching hostname, but as far as I can tell, there isn't a way of getting the hostname of the requesting computer.

I have full access to both the server and the kiosk. The server is a standard LAMP setup, and the Kiosk is a Windows 8.1 machine with a single touch screen (ELO) running the Metro app Kiosk Browser by riro.

  • 写回答

1条回答 默认 最新

  • dtotwai720621 2014-12-10 11:48
    关注

    Since you have the ability to use php and have access to the kiosk computer I would use a configuration file just for the kiosk.

    1. Create a text file and save it as kiosk.txt for example.

    2. Place a line of text in the kiosk.txt to test check if it exists.

    example: kiosk

    1. Place a check in the index.php file to determine if the kiosk.txt file is present with the proper value on the client machine.

    The PHP could look something like this placed in the head section of your index.php file.

    Example 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
    

    Alternatively you could pass a http get variable to the index file which may work better since you are serving the php from another computer and not the kiosk.

    make the shortcut or link that loads the index file look something like this:

    http://kiosk.com?kiosk=true

    Then in your index.php file place a check to see the kiosk get variable is true

       //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
    
    评论

报告相同问题?

悬赏问题

  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序