0

I intend to create an HTML report from a perl script on Linux/Unix side. The report contains various statistics mainly in the tabular format. Since there are many such tables I want to split them into categories using Tabs. The report then will be sent to some email-ids, as an attachment.

The questions are:

  1. Is there a good example of HTML + Javascript to create such tabs? I could not find a complete example

  2. Libraries like jQuery fits the bill except that I need to give the .js file as well, which becomes a bit tedious. Is it possible to somehow embed jQuery (or any other library) in HTML?

Thanks in Advance!

Sudeep
  • 107
  • 1
  • 11
  • 1
    Some of email receivers may not be using browsers to read their emails, then what--how they'll see your tabs for example with alpine, mutt... huh? You should send email content with minimal formatting. – Vishal May 22 '12 at 06:23
  • You shouldn't/can't do that: Have a look on that http://stackoverflow.com/questions/1088016/html-email-with-javascript – Rakesh Juyal May 22 '12 at 06:27
  • Till now the report is plain HTML. In the meanwhile I am exploring if I can pack jQuery and my report (html) somehow. The HTML file will be sent as an attachment. So I do not think the email client will do anything to it. – Sudeep May 22 '12 at 06:27
  • 1
    @Vishal, the report will have to be double-clicked and then it will open in the browser. This is acceptable in my context. – Sudeep May 22 '12 at 06:34
  • So you're sending a HTML file as an attachment which can be downloaded by the receiver, right? – Vishal May 22 '12 at 06:39

2 Answers2

1

I hope this answers your questions

  1. Use jQuery UI which is an extension of jQuery library, Or you can use ExtJS and there are lots of UI library depending on how much you want.

  2. Why does giving JS file become tedious ? use script tags to call the external JS files to use these libraries. Embedding JS in your HTML will clutter it and its a BAD practice.

Checkout

EDIT:

If you are planning to use JS in emails, forget it. A lot of email clients remove JS content. Instead

  1. Share a google spreadsheet link with email
  2. Generate a PDF that has the report, there are a lot of libraries that convert HTML to pdf , use them and convert an HTML table to PDF.
Amogh Talpallikar
  • 12,084
  • 13
  • 79
  • 135
  • The report will be sent over emails. Don't u think it will be tedious for someone first download the report and then open, rather than just double click. Actually it will not be one off report. The frequency will be much higher. – Sudeep May 22 '12 at 06:19
  • Thanks Amogh. PDF is something I can explore. Google Spreadsheet it a good idea however, companies can be paranoid over their data being shared on the net :) – Sudeep May 22 '12 at 06:32
  • 1
    @Sudeep: HTTPS and Google login for Google Spreadsheet is a lot more secure than email. – Asherah May 22 '12 at 07:18
1

Take a teaser approach to this one where its a hybrid of INLINE html + actual links to go to real content.

  1. Just take a screenshot of the real tabs and place as the header image in your email
  2. Below the tabs image, place only the first page of the tab content
  3. Upon clicking the tabs in the email it takes them to the actual page
  4. The URL can be tokenized and be HTTPS so it will be somewhat secure to view via link

The real tabs can use jQuery UI as others have suggested.

King Friday
  • 25,132
  • 12
  • 90
  • 84