Embedding a dynamic app in a jekyll blog - jekyll

I am trying to embed a dynamic (Elm) app that has it's own routing into a jekyll blog. I load the app by adding a page in subdirectory that loads html that includes the javascript file holding the app.
However, the app has certain links that when clicked navigate to a path /some/path/123, where 123 is an id. The app then makes a request to fetch the relevant data and displays it.
This is where I run into trouble because Jekyll intercepts these redirects and the server displays a Not Found Error because there is no page setup for that path. Does anyone know how I might get around this problem? Otherwise, I suppose I will server the app on a subdomain.

Jekyll isn't a server so it can't intercept any request, there is no page generated in the requested path (it just comes with a server for testing purposes).
Put Jekyll into a sub directory and serve the other app as usual.

Related

Azure website hiding .html extensions

Im hosting a couple of html files using an Azure website. I want to hide the .html file name extensions. I have been looking trough the site however i didnt find an options that works specifically with Azure websites.
You could use a URL Rewrite in the web.config file for an ASP.NET application to send a 404 or some other response for .html file requests.
Also, you could probably set up a custom HTTP handler mapping for .html extensions. That way a language processor could intercept those requests instead of just serving the file.

Serving local file:/// links and AppCache

I'm making a webapp for members of my caving club to search through and view cave survey note PDFs. It works fine, and I got the AppCache working for the web version of it.
However, since the PDFs are quite large and slow to download, and many members have the PDFs on their local machines from the same SVN the website gets them from, it would be ideal for them to be able to use a page with links to a local SVN folder of their choosing.
The design goals:
The site displays links to PDF files on the local filesystem
Whenever I add features to the site, users get them automatically the next time they open the page and they're connected to the internet
But after the first time they open the page, the site works offline.
Sadly web browsers don't appear to support this useful combination of design goals at once.
I can satisfy #1 by having users download a copy of the site, add their local SVN path in a JS, and open their local copy in the browser, so that file:/// links work.
I can satisfy #2 by having absolute links to JS bundles on the server.
I can satisfy #3 by using the AppCache.
I thought I could get clever by having the copy of the page on the local file system have <html manifest="https://myserver.com/myapp.appcache">, but unfortunately Chrome doesn't seem to allow a local file to use an app cache manifest hosted on a server, for seemingly no good reason to me.
Does anyone know of another way I could satisfy all 3 goals?
Perhaps there's some simple program/config I could give my friends that would intercept web requests to https://myserver.com/some/folder and instead serve them out of a folder on their local file system?
Andy,
I know this post is a bit old but came across it looking for something else related to AppCache. My understanding it that the html page and the manifest must reside in the same domain for it to work. So I think you need to modify your design:
Create a JavaScript function that acts as a setting for the user to enter the path to their local copy of the PDF's. Store this information in localstorage.
Create a html template page for the document links.
Create a JavaScript function that populates the html template page with any documents and links the user enters.
This way, the users visit your application online and it uses appcache to store itself and the JS files for offline use. To access the PDF's, the user clicks a settings button that launches a page to collect path information and saves the information in localstorage. The users can then access the template page which will populate with the documents they entered.
Here is a good intro to localstorage: [http://www.smashingmagazine.com/2010/10/local-storage-and-how-to-use-it/]

Website Configuration on Google Cloud Storage without error pages

I have a single page application that I am (trying) to host on Google Cloud Storage.
The application is at index.html, and the application handles routing using Angular's html5Mode. (e.g.: routes like example.com/this and example.com/that are handled by the js application in index.html)
Using Google Cloud Storage's website configuration this is all well and good, except that routes that are accessed directly ("example.com/this") will 404 as they obviously do not map to a file.
I have set my 404 page to be my index page, but what I really need in order to run a single page application in html5Mode is that such routes ("example.com/this") will not return a 404 header - they will simply be handled by index.html and return a success header (200).
Is this possible?
Setting index.html to your 404 page from the website configuration seems to do the trick now.
Unfortunately, this isn't really possible. Google Cloud Storage's web mapping is pretty simple, and you can't create arbitrary rules based on patterns and the like.
You might want to consider either disabling html5mode or forcing a hashbang with html5mode. See this answer for more on that option.

How to load a Single Page Application from a file?

I'm trying to build a single page application that can be viewed offline, and that can be packaged (preferably as an HTML page), and emailed out. It needs to be able to load from the file I email out, but not hit a server at all on load time. It can load JS libraries from their servers, but the page itself will not be hosted anywhere.
This seems like a simple problem, but I'm having trouble exporting my current spa site into a static format that can be emailed.
Currently the site is built in ASP.NET MVC 4 as a WebAppSPA. The application is a bunch of graphs built from data in a JSON file.
Thanks in advance for the help!

Given URL is not allowed by the Application configuration. when using the Facebook Javascript SDK

Im currently using the Facebook Javascript SDK and I keep running into the following problem that appears in the console:
Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.
I've read a truck load of related posts but still can't get it to work. I am working locally using the following: http://localhost:8080/bookbayapp/. In my facebook developers app section I have the following:
But once again nothing seems to work. I am currently using Google Chrome for the testing and it is worth to mention that I am using the Facebook Plugin for Phonegap but when testing I comment out the link the to plugin js so I assume in doing this there shouldn't be any problems?
What works for me is using the actual URL of the production server, and then adding a line to the hosts file that redirects all traffic from that URL to localhost.
Let's say your website is called potatoes.com. In "Site URL" write:
http://potatoes.com/bookbayapp
and then open your hosts file (C:\Windows\System32\drivers\etc\hosts) and add the following line:
potatoes.com 127.0.0.1