How can I print .docx,doc,xls,csv in rails 4?
I tried window.open and window.print using javascript, but each time when it invokes window.open it downloads the file.
I tried to embed that in an iframe, that also fails.
Displaying a specific type of file isn't something that relies on your application it relies on the browser. In common browsers there is no support to display the file formats you mentioned.
What you can do is implementing some document viewers based on js if they are available for your usage. For example I know there is a plugin viewer.js that provides functionality to convert office and pdf to html. That might help you out... https://developers.box.com/viewer-js-tutorial/
I tried doing this some time back and this is the blog which i refereed. Helped a great deal.
Hope this helps.
Related
I have looked around the web and have found that appending #page=?? to the end of a PDF link will automatically take the visitor to that specific page in the PDF file.
I was wondering if this is still best practice as it doesn't seem to be working for me (Chrome on Windows 7). Also, all the articles I have found so far date back to 2006-2008, have things changed recently?
This is still valid code but it may require that some version of Acrobat (Reader, Pro, etc) be installed as a plugin on the browser in order for it to work as expected. Since multiple commonly-used browsers now have a built-in reader (Chrome, Safari for iOS are the big two that come to mind) support for direct page linking is somewhat spotty now. You can still do it...the worst case scenario is that the PDF just opens to the first page for those users but I would advise to just leave off the direct page link. If the page is that important, extract it to a separate PDF and link to that.
I'm using Ruby on Rails 2.3.8 and I would like to know how to open a popup using Ajax, instead of jQuery, so when I click in the link that will open it, an action is executed to load some collections and other stuff.
Thanks in advance!
First i think you are messing up some concepts here.
JQuery is a javascript framework and AJAX is a set of development methods.
See: http://en.wikipedia.org/wiki/Ajax_%28programming%29
and: http://en.wikipedia.org/wiki/Jquery
I think that you mean "How do i open a link in a lightbox like screen instead of a javascript popup".
(correct me if im wrong interpreting your question :)
Please take a look at some open source tools like:
http://chriswanstrath.com/facebox/
http://fancybox.net/
And there are tons and tons of other alternatives.
Just google for "lightbox"
I tried to analyse how google is transfering data. Especialy the document.referer.
for me its not ajax (firebug do not show any ajax activity).
PHP do not show the $_SERVER['HTTP_REFERER'] very reliable
Any idea?
Is there a uncompressed sourcecode of the ga.js in the world?
Use Javascript unpacker and beautifier for the unpack.
for me its not ajax (firebug do not show any ajax activity).
Just pay attention... look at the JS tab or Firebug.
You are adding http://www.google-analytics.com/ga.js in your page.
So, even before the page is loaded, googgle-analytics server already got a request sent to it :)
There is no need to use ajax.
And you can beautify ga.js using the tool Adnan has mentioned in his answer to see what the ga.js does after it is loaded
==== EDIT ====
Instead of including ga.js try using http://www.google-analytics.com/u/ga_debug.js
It is still minified and compressed, but it does have plenty of logging and debugging info
http://code.google.com/apis/analytics/docs/tracking/gaTrackingTroubleshooting.html#gaDebug
After the analytics file is downloaded, it runs and reads document.referer in Javascript, and then sends this information off to Google. You can see all the parameters it collects by looking at your browser's dev console - here's a picture from Google Chrome:
Can someone point me in a direction so that I can use embed code in Rails? Sometimes I need to embed a slideshow pro file and sometimes I need to embed a youtube file and sometimes a vimeo file in the same area for different entries, it would be easiest to use embed code but it keeps stripping the embed code.
Do use a santize plugin? Can someone point me to a tutorial or give me some help to get me started?
thx
Ok, so the plugin was not the answer to my question --
I wanted to simply add embed code to my rails application -- basically in the same area of my site -- sometimes I wanted to add youtube, sometimes, vimeo and sometimes something coming out of slideshow pro director -- a .swf that is fed by an XML feed.
So after a ton of research on this site and many others -- I found there was a simple solution.
escaping html in RAILS.
xss_terminate
http://www.railslodge.com/plugins/910-xss-terminate
xss_terminate is a plugin in that makes stripping and sanitizing HTML stupid-simple. Install and forget. And forget about forgetting to h() your output, because you won't need to anymore.
But xss_terminate is also flexible. By default, it will strip all HTML tags from user input. This is usually what you want, but sometimes you need users to be able to enter HTML. The plugin allows you remove bad HTML with your choice of two whitelist-based sanitizers, or to skip HTML sanitization entirely on a per-field basis.
This plugin did it like a charm -- just remember to remove the h from
<%=h #article.body %> to <%= #article.body %>
Here's a sample rails app with vimeo integration. It looks like it makes use of this great vimeo plugin. From the README:
This gem implements a full-featured
Ruby interface for the Vimeo API v2.
Sounds like it might be just the ticket!
I normally just create a body area_input with RedCloth, this allows for simply drop embedment code inas well as text image etc.
I would like to display the yahoo weather widget (or any similar flash or java based widget) in a Delphi application. I freely admit I don't quite understand what would be required to make this work.
Any suggestions on how this could be accomplished would be appreciated.
I'm using Delphi 7. All of the Widgets are just HTML Code, which when I cut & paste them to my Blogger page for instance, show up and work fine. I'm not sure how to take that same html code and use it in a Delphi form to get similar results.
Detailed instructions would be appreciated as well as an explanation. Clearly I don't quite understand how this works... I only know what outcome I'd like ;-)
Thanks Rob, it wasn't a memory issue, butt he admins did take care of it as you suggested.
Mark
Basically, you want to host the SWF ActiveXObject.
http://delphi.about.com/od/graphics/l/aa040103a.htm
As mentioned above you could host Flash's active X control for a flash control.
The other option is to use an embedded webpage (possibly loaded off the local disk) using the built in Delphi TWebBrowser control to show any web content including Java or Flash controls (as long as they are installed on the client).
Hope that helps.
I have a video on embedding flash into Delphi Applications Available Here. If the widget is a flash file (.swf) it should be fairly easy. The other option (as already mentioned) is to use the Delphi TWebBrowser component.