rails page won't display entirely - ruby-on-rails

I'm having the most peculiar problem, and I was hoping I someone could point me in the right direction on how to address it (or even locate it...). I'm working on a rails site, and the pages display in most browsers without any issues. In others (AOL, IE 6 - 7, and some of the other lesser used ones) the page will load, with all of the correct formatting, but completely missing the inside content.
For example, the site uses a traditional online store format, but will load the name of the site, the name of the product, and the page footer, but not the description or images. This issue has been reproduced on several computers, but I can't figure it out at ALL.
Thanks for any help!

My approach to this sort of problem would be to use the browser to get the html you are trying to render (in firefox, View>>Page Source), and saving it as a static html file. Then you can fiddle with this file one piece at a time until you figure out what's throwing IE for a loop.

If you view the page source is the data you are looking for included? This can help you figure out if you have a formatting issue on the client side or a data generation issue on the server side.

Related

Any way to force webpage to print exactly as it looks in browser?

I am looking for options on how to deal with an issue as I don't think there is an easy fix.
We're dealing with a really stubborn client that doesn't want to accept the fact that browsers don't print css backgrounds by default.
He's convinced that XP running IE 6 & 7 are the most common browsers and we are a bad company for not supporting them. (I've shown him analytics from our typical client's visitors but it hasn't changed his mind). I'm rewriting his site to work on them but am stuck with the print stuff now.
He would like (demand is a more accurate term) to have the page print exactly as it looks on the site as well as them look exactly the same in all operating systems & browsers. I don't think it's feasible to go through and put all the images in the html instead of in the css and I've tried the list-style tip without luck. Lots of the color of the site comes in from background css colors as well.
Is there any other options? Or even suggestions on how to deal with this client?
Try something like:
<style type='text/css'>
#import 'whatever.css' screen, print;
</style>
Make sure #import is above all other CSS tags, and that you target the external stylesheet that you have your CSS for your page on.
Here's a slightly different approach:
I would consider converting the web page to a pdf which you can print instead.
An nice way to do the conversion is through a product called PhantomJS. It's essentially a headless browser that will render the page and convert it to a pdf on the fly. You can integrate by running the PhantomJS server and add a link on the original page to download the pdf.
The pdf will then print the page consistently across all browsers. There is however a decent amount of additional work, so you have to consider if it's a good fit for your needs and timeline...
Additional complexity with this solution is that you have to host the PhantomJS javascript server somewhere, write a PhantomJS script using the API to convert your page to pdf.
Pdf and image conversions are relatively easy to do, but you have to also consider authentication if your pages require login. PhantomJS will write the converted file to disk on the server, so you would also have to manage downloads to the user's browser.
All in all it's a good chunk of work, but you might find it interesting to at least learn about it :-).
More info here:
http://phantomjs.org/

How is this URL modification possible?

Could anyone please tell how the site http://www.outsharked.com/imagemapster/default.aspx?what.html is working in such way? Modifying the url without loading/reloading the page. I think this is not done by html5. Because it works in IE6 which doesn't support html5.
I created that site. The commenter is correct, it uses Javascript to change the URL. There's nothing about how that navigation works that is different for IE6 - that browser supports the necessary client-side functionality to do this kind of thing. The basic functionality involves:
capturing click events on the nav, and loading the inner content via AJAX
update the URL to reflect a working direct URL to target.
The links also are valid anchor links that, in the absence of Javascript, would go to the same page (but load the whole thing). This is your basic AJAX web site setup with one minor difference. It's common practice to use a URLs like this in AJAX/single page web sites:
http://mysite.com/home#somepage
or even just
http://mysite.com/#somepage
Where the hashtag part represents the actual page a user has navigated to. If someone accessed that url directly, e.g. from outside the site, the site would use Javascript to load the correct content based on the hashtag, after the page had loaded. This means that there might be a little delay for the inner content to reflect the correct page, since it has to run another request after the initial page has loaded from the browser to get the inner content via AJAX.
I was trying to avoid that by creating a setup that worked completely with and without Javascript. If you go directly to a URL within the site such as http://www.outsharked.com/imagemapster/default.aspx?faq.html you will notice it loads the content directly. This URL will work even if Javascript is disabled. You can't actually do this using hashtags, since hashtag content is not sent to the server. Only the client knows what's after the hashtag in a URL. That's why I was using query strings to represent inner pages.
This site architecture was sort of an experiment at the time. It works pretty well but the code isn't fantastic, I didn't really do anything else with it, and I'm sure there are other better-fleshed-out/tested/full-featured frameworks out there to do much the same thing.
But it might not be a bad example of the nuts and bolts of creating a basic AJAX navigation setup, as a learning tool, since it's pretty concise, and also does HTML5 history navigation (e.g. so the back button works on modern browsers).

Stop part of page being index by search engines?

How can I stop search engines indexing part of my page? Is there an HTML5 element for this?
Its just a line of text that I want to hide (a co-worker doesnt want their name on google for some reason). Im thinking that I could inject the text with javascript, but I have heard google does sometimes look inside javascript files.
I also thought of using images instead of text, but im concerned how this will look cross device and platform. Ive noted text rendering can differ on mac and pc and thats before ive had to think about mobile devices, retina displays, etc.
Thanks
You can't hide content unless you use the methods you've already outlined above. Your best bet is to use JavaScript in an external file and then block that file using robots.txt.

Ruby on Rails Mysterious Javascript Alert box with cookie information

I have a problem in a Ruby on Rails app that I am working on. I have been working on the app for months and I have never had this problem before and after a bit of Google searches I think that somehow someone is trying to steal cookies with javascript.
When I click on the link I get an alert box titled "the page at www.napkinboard.com says:" and contains the following message:
__utmz=217223433.1270652009.59.3.utmcsr=localhost:3000|utmccn=(referral)|utmcmd=referral|utmcct=/; __utma=217223433.2133018314.1265749085.1271097412.1271125626.63; __utmc=217223433; __utmb=217223433.11.10.1271125626
I checked the database and all data associated with this 'food_item' looks completely normal and does not contain any javascript at all.
How did this suddenly happen and how can I stop it? I appreciate any help. Thanks.
EDIT: Can't believe I forgot the URL: http://www.napkinboard.com/food_items/413
It sounds like you've found a link that exploits an XSS vulnerability using the query string.
Make sure to properly escape all of your output.
load up firefox and firebug, and see what the javascript and network stack trace show. That should give you an idea of where it's coming from, etc.

Umbraco - postbacks caching problemm

I'm having a problem with a page I'm developing in umbraco. I'm fairly new to it so would really appreciate some guidance.
the problem seems to be connected to the way umbraco caches pages.
what i have is a stockist locator map (a map of Australia in my case).
from this page, the user can select a region to see stockists within that area.
i have a big fat search button along with some checkboxes for the user to choose what region they want to search in.
when i check say 'Sydney' and hit my search button, all is well. it returns the results i would expect.
but... if i go and click the search button straight away (again) - then the search results disappear.
its almost like umbraco is doing some weird caching thing. I've tried fiddling with the caching settings within the developer area (i.e. 'Cache Period'), but haven't spotted any consistent patterns which shed light on the problem.
oh, another thing - its not executing the page load and pageInit events (when retrieving from the cache).
So when you submit you control without selecting anything, you get empty result. Can this be, that is the logic of a control itself? As I see, it just gives empty result for empty search query.
Can you provide some sample code to demonstrate your implementation?
I've done plenty of Umbraco sites and have rarely found that Umbraco interrupts the normal ASP .Net page lifecycle so I'd be more inclined to guess you have a fault in your code.
Have you tried disabling your custom caching completely to ensure that the issue does not relate to your code?
Does your cache have a param dependency that is being cleared or anything?

Resources