Page not rendering in rails - html

The problem with my rails 5 app is that I have a link on a page that sends the user to example.com/PlaceHolderRoute. The route points to an action in the pages controller. The action is simply:
send_file('public/files/downloadable.pdf', type: 'application/pdf', disposition: 'inline')
I know that disposition: 'inline' will make the browser render the pdf, that is what I want and that's what it does. The issue is when the user uses the browsers back button. When the browser goes back to the page with the original button the pdf is still rendered on the screen & the page is not visible.
I've tried using a separate view for the action with an <object> tag for the pdf, but suffer the same problem. The page does become visible once it is manually refreshed. I've also tried using <meta> tags to prevent any caching to no avail. Something I also noticed is when the back button is used the URL in the browser does change and the server does respond as per usual. I think this a browser problem but I find that unlikely being this happens on every browser I've tried (Chrome, Firefox, Vivaldi, etc). Can anybody help me on this?
Edit:
This behaviour was not observed on Sinatra (still only using the same routes, html, & send_file)

Related

Chrome can't see images that require username/password

So this is a weird problem, I am attempting to embed a video stream from a D-Link DCS-930L into a web page. My embed looks like this:
<img alt="" src="http://guest:password#192.0.0.10/video.cgi">
The problem is that Chrome displays a broken link image when I load the page, while Firefox and IE load it perfectly the first time.
But the really strange part is that if I right click on the broken image > Open link in new tab the stream loads, and then if I close the tab and refresh the page with the embed it loads there too! So it's definitely something to do with the username/password requirement.
I have also tried creating a user without a password but I see the same issue. There is no setting to disable this requirement in the 930L's control panel that I can find.
Does anyone know how to fix this? If not, is there a way to use PHP to execute a login automatically for the above kind of URLs?
This appears to be intentional behavior on Chrome's part since v19. Bummer.

Why doesn't a website display properly in Google Chrome normal mode but displays fine in Incognito mode and all other browsers?

In my end the webpage looks good but in my client's end the page doesn't load properly or just the vertical lines show up without the text and images.
Link to the website : http://www.krishnaprasad.me/Iadmire.html (Inactive now).
The website looks fine in all browsers for my client except Google Chrome that too in normal mode.
I've used Foundation 5 framework for developing this site. If it's an issue with browser's extensions/plugins at my client's side, can I automatically disable that?
Let's start with the easy part: You cannot disable a plugin or extension from within JavaScript (if that's what you meant by automatically disabling). The only way that I know of to disabling those is for the user to actually open the Extensions page in their Browser Settings and manually disable those.
You can, however, detect the presence of problematic plugins or extensions in JavaScript and, for example, redirect the user to another page where you ask them to disable those plugins.
I've taken a look at the page and I found the culprit: One of elements had an id of adcontent, which I am guessing is black-listed by either Chrome or one of the plugins.
I believe that if you could change that id to something else, and adjust the CSS appropriately, the issue should be fixed.

Empty IMG SRC trigger logout in IE

I'm developing a web system now, and have debugged a very strange bug just now.
First I describe the bug itself here.
Problem:
When visit http://mysite/, it redirects to login and do logout at once.
There is a page, which url is /site.php?arg1=xxx&arg2=xxx everything is well in chrome, but when I use the ie8, after this page loaded, the account is logged out!
Bug Location:
After a long term of debugging, I found that the point which causing the problem is:
<img class="item_thumbnail" src="" />
If I remove this tag, everything become good.
So I'm wondering: when the <img> tag render, what's its behavior? Will it request the login page? But everything is in mass with ie.
What cause this problem? And what will ie an non-ie deal with the img-src?
Need your help!
As I suspected, according to
Empty image src can destroy your site
Internet Explorer makes a request to the directory in which the page
is located. For example, if you have a page running at
http://www.example.com/dir/mypage.htm that has one of these patterns,
IE makes a request to http://www.example.com/dir/ to fill in the
image.
Safari and Chrome make a request to the actual page itself. So
the page running at http://www.example.com/dir/mypage.htm results in a
second request to http://www.example.com/dir/mypage.htm to fill in the
image.
Hit F12 and look in the network tab to see.

Loading same AppCache - based url won't work on firefox and safari

I have an html that is AppCached. I load it on the safari/firefox and everything's fine.
then, I paste the same url and hitting enter in my keyboard, nothing happens (in Chrome it performs a reload).
The reason I'm interested in this scenario, is that I'm actually using URLs with hashtags, and I'm pasting the same URL, the hashtag is different and I wish the page to reload (this is the common use case in mobile when you click on links from email and such).
Can anyone explain why the browser won't reload?
If you want the page to refresh then you can't use hashtags, the whole point of hashtags is not to refresh the page when changing the URL. It sounds like what you need to do is listen to the hashchange event instead of doing it all in the load event.

Google Chrome intermittent load issue: possible to Programatically disable "Predict network actions..."?

I'm having a very strange problem with a site in Google Chrome:
When I click on a link (from a list view to a detail page), the page hangs and I Chrome throws up a dialogue asking me to kill the page. The page is never displayed.
But if I navigate directly to the page, it loads in Chrome without any problems. Both actions (clicking on a link or navigating to the page) work fine in Safari and Firefox.
Disabling "Predict network actions to improve page load performance" in Chrome's settings seems to fix the problem, but this is not a viable solution as I don't have any control of my user's browser settings.
Some more detail about the situation:
The link is just a regular <href>. I'm not doing any javascript
click() handling or anything else. I'm not using any 'prefetch' or 'prerender' <link> elements.
The pages all validate using the W3
html5 validator.
The page I'm navigating to loads a lot of JS, uses Knockout.js for rendering and loads a video file over HTTP.
On the occasions that the page does load (after a very long wait),
Chrome appears to have rendered the entire page in the background and
loaded all external resources. If I navigate directly to the page it
doesn't preload anything though (I'm using knockout to show a 'please
wait' message while the external resources load).
When I log the network requests using Charles, it appears that
Chrome loads the HTML for the page instantly, but the requests for
the external resources seem to take forever.
If I look at the CPU usage in Activity Monitor, 'Google Chrome Renderer' uses 100% CPU when loading from the href, but only 30% when loading directly from the page.
I'm using the latest version of Chrome (22.0.1229.94)
So - my question
Is there a way to programatically disable "Predict network actions to improve page load performance"?
Or is there some other solution to this problem?
Just going through high voted unanswered questions I came across this one, and I once got into a similar situation for entirely different reasons (chrome was preloading a huge file I couldn't afford to load for every user). The fairly simple solution I applied back then was to open the link through Javascript rather than a simple href which worked wonders. Either way, your problem might already be solved, but seeing the number of views I thought I could at least share this small insight.