Hosting a website
linzycumbia
Posts: 27
I have scoured the forum looking for code that will host a website that has folders, css, html, javascript, images, video, compressed archives and many other filetypes. I want to put the files for my website on my microSD card. I tried the code located here: http://forums.parallax.com/showthread.php?127340-Basic-GET-and-POST-Object-Updated-1-1-2011 but it did not work unless I removed all css and javascript files and I need both css and javascript to power my site. Is there any code already written that I may have overlooked in the forum? Is there any code available to do this?
Thanks in advance
Thanks in advance
Comments
You must add the appropriate content type to the WriteResponseHeader for example "content-type text/css". This working fine in IE. I had trouble in Firefox. I have not spent the time to figure out the issue with Firefox. Maybe you can?
BTW, there's a newer object on
http://forums.parallax.com/showthread.php?128445-Dynamic-Spinneret-with-HttpRequest-Object-and-EEPROM-Configuration-Page
Edit: scratch that Firefox, IE, Safari, and Chrome all work using a relative link to a css file or JavaScript file. IE will sniff out the content type returned from the server while Firefox, Safari, and Chrome want the appropriate header sent from the server. You can see the resource requests in the log file. http://spinneret.servebeer.com:5000/index.htm
The same thing goes for video, you need a the appropriate header. Here's an WMV from my trip to San Diego served up by the spinneret. http://spinneret.servebeer.com:5000/video/gwhale.wmv Kinda' weird that IE poops out but Firefox, Chrome download and play the file no problem.
Post your code if you're still having problems.
As far as, I know the HttpRequest object works fine. There's not much to it, just an HttpRequest parser.
Post your code if you want help. Otherwise there's not much we can do.
You're going to have to do some troubleshooting to see if you can get your multimedia site up and running on the Spinneret. I would start with removing all the dynamic content stuff I wrote and focus on just the static content. Start by opening the Parallax Serial Terminal and loading the index page. You should see the header requests on the terminal and the request that causes the lock. Finally , add this to the HttpServer.
Happy programming
The content type for a tiff is image/tiff or image/tff.
And those <!--/Controls-->" and "<!--/Content Inner-->" are just html comments
I will check the JS
Source code:
http://www.agaverobotics.com/spinneret/source/
I made some changes to the vidcontr.js file. Do you still get errors?
I tested you web app in IIS first to make sure it worked before dropping it on my Spinneret rig. I thought you should fix those errors before messing with the SPIN code. I'm sorry; I just don't have the time to verify your web application. Let us know how it goes.
StringSend(0, string("Cache-Control: private"))
The header line "Expires: Wed, 01 Feb 2012 01:00:00 GMT" tells the browser to use the file in cache until 2/1/2012. Obviously, this is not the best method. But it should work for now. Just remember to update this method if your CSS, js, or ico file changes.
Configuration!
Have you tried another port just to be sure? Configure your router to forward port 5000 traffic to the Spinneret on port 80. What is your IP?
Don't know.... What you're saying does not make sense or you did not supply enough information.
Is the Spinneret listening on port 80?
Did you forward port 5000 to 80?
What is your IP?
Someone on the forum can check connective if you at least supply the address to hit!
If you're trying to hit the Spinneret from your local network and the Spinneret is listening on port 80, your router is going to resolve that address internally to the default port 80 if a port was not specified.
What kind of file? A web page? image? video??? What happens when you try to serve up the file? Do you get an error? If so what error? What browser are you using? Safari?