Strategies to let a separate app talk to javascript in the browser
Here's the scenario: we have a separate app running on a computer (outside of the browser). It creates a folder with 10,000 downloaded thumbnail images.
In the browser, we have a traditional browser app. It lets you browse through these imag开发者_开发知识库es. In order to speed up the browsing dramatically, I want to let the app get the images from the local drive, if available, ie. img src="C:/..."
instead of img src="http://..."
The app can talk to the server, and let it know the path to the images.
I'm trying to figure out how to (lightweight) let the browser know that on this particular computer, we have a folder with images, whereas on another particular computer, we may not.
My best guess so far is have the app write a cookie to the browser. Is that the easiest/most elegant/most lightweight way of doing this?
The app could just add some javascript variable to the page. e.g. for PHP
if($hasImagesFolder) echo "var hasImagesFolder = true;";
else echo "var hasImagesFolder = false;";
精彩评论