We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you've provided to them or that they've collected from your use of their services.

Connection Problems

The web browsers (I know only those working in Windows) respect the single-domain restrictions.  It means that they set special requirements for pages opened within domain A, trying to communicate with a domain B.  As a consequence files stored on a local drive opened in a  browser will not be able to read data from the web server of the PLC.

The solution is to use the CHROME browser and opening it with parameters "--disable-web-security --user-data-dir=ABC", where ABC will be the path to the direcotry in which the html file is stored.  Do not worry, it will not switch off all you web security.  Just the "same-origin policy" will be disabled.  Here is the description of the parameter.   It has been explained as: "Don't enforce the same-origin policy. (Used by people testing their sites.)"

Technically I propose to make a copy of the Chrome shortact a to modify it:

link modification

by adding at the end of the  "Target" element the parameters: " --disable-web-security --user-data-dir=...".

For the change to take effect you need to close all instances of Chrome and reopen the browser. You should see the following message:

chrome message

If you feel that for the normal everyday browsing you need Chrome without any modified parameters I propose to make a copy of the shortcut, modify it as described and rename it to, for example,  "Chrome PLC".

After making the above changes html pages opened from the local drive should easily communicate with the PLC.

Other approaches are:

  1. Upload all your files to the PLC to webserv directory.  The solution is effective but cumbersome.  It is difficult to test, the communication last longer, OR
  2. Use Chrome with the above-described flags.
  3. If the above-listed solutions are not acceptable to you, I will try to write in the next article, how to talk to the PLC via w proxy (external web server).

So, how to start?  Donwload the Connection_Test.htm, change the ServerName variable value to your PLC's IP and:

  1. Save the file on your drive/desktom and run with Chrome with the " --disable-web-security" parameter, OR
  2. Upload to PLC to the webserv directory and run with Chrome/Firefoxie or Maxthonie entering in the address bar: http://YOU_PLCs_IP/Connection_Test.htm,  OR

If none of the above-mentioned options works - send an email - I will try to help.