Sunday, April 8, 2012

Showing a demo of my CSS on any website



I have developed a small component which can be put in to any website. Now, I want to develop a code that could demonstrate how would my component look like on any website.





So, the person would come to my page and put in his URL and then my code should embed my custom JS/CSS in to the downloaded HTML and display it. Something like this .





Here, like the feedback tab, I want to show my component any where on that page.



Source: Tips4all

4 comments:

  1. Nathan's answer is the closest to how we have done the demo feature at WebEngage. To make such a demo functional, you'll need to create a Javascript widget that can be embedded on third party sites. syserr0r's answer on creating a bookmarklet is the simplest approach to do so. Our's is a JAVA backend and we use HttpClient to fetch the responses. As Nathan suggested, we parse the response, sanitize it and add our widget Javascript to the response. The widget JS code takes it on from there to render the Feedback tab and load a demo short survey.

    Disclosure: I am a co-founder and ceo at WebEngage.

    ReplyDelete
  2. I recommend using bookmarklets. I've made a bookmarklet generator for adding jQuery-enabled bookmarklets to a page to make development easier.

    There's a caliper bookmarklet on the page that you can mess around with just to show an example of it working.

    Full disclosure, this is something I've made, I'm not trying to be spammy as I think it's relevant: zbooks

    ReplyDelete
  3. You could make an iframe page, which loads their page in the iframe, and uses javascript to inject your code into the iframe.

    ReplyDelete
  4. I agree with the bookmarklet strategy.

    I'm a fan of http://bookmarklets.heroku.com/, which lets you generate bookmarklets easily, inject jQuery, etc.

    ReplyDelete