solidusjs / devtools-solidus

0 stars 0 forks source link

Check if a page is a Solidus page before inspecting. #4

Closed localjo closed 10 years ago

localjo commented 10 years ago

It doesn't make sense for the Solidus devtools to run on a non-Solidus page, so we need a way to check if a page is a Solidus page before the Solidus devtools runs on it. The Grunt, Facebook React, and other devtools extensions do similar checks and don't run on pages that aren't using those tools.

There are a lot of ways we can check if a page is a Solidus page. @pushred and I had discussed using the page's x-powered-by headers. Currently that header shows Express, but we could potentially change that to be more specific to Solidus. The downside of this approach would be that it requires a second XMLHttpRequest to check the headers with JavaScript. Since we have to request the page's JSON object anyway, maybe we could just check that route and make sure that it's a Solidus object before running the rest of the DevTools. That would save a request and wouldn't depend on us changing the headers.

Another option could be whether or not a page has a Solidus object, though @pushred had mentioned that the pages may not be served with a Solidus object in the future.

Perhaps a meta tag in the HTML head would be another workable option to consider.

localjo commented 10 years ago

Duplicate of #6