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)
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.
I'm developing a Google Chrome extension where bookmarks are displayed on the newtab page. Everything works fine so far except for the favicons.
Entering this URL in Chrome displays the favicon of a page:
chrome://favicon/https://stackoverflow.com/
However, in the newtab, which I properly set up, they don't get displayed.
The HTML is very simple, though:
<img src="chrome://favicon/https://stackoverflow.com/" />
I don't think it's anywhere in the docs, but accessing chrome://favicon/ needs a special permission "chrome://favicon/" in the manifest.
Do note:
This may change in the future.
chrome://favicon is not entirely reliable.
I'm having an issue with a named anchor tag in iPhone Safari browser. It works well in desktop browsers including Safari, but not working in mobile Safari. Weird!
For example my URL looks like:
http://www.example.com/my-example-article-url-is-like.php#articlebottom
the above URL is from a newsletter and it should go to the bottom paragraph in article page which I gave id like this:
<p id="articlebottom">paragraph is here</p>
When I click the above URL from Newsletter it goes to the article page, but not the bottom para where I specify id. Although I can see that the #articlebottom part is missing from URL when it came into the targeted page in Safari.
Any thoughts would be appreciated!
Opera, IE, Chrome and Firefox will carry over the anchor to the new page. However, Safari loses the anchor on the redirect.
So what if you add / just before the ID Tag?
Old URL Path:
http://www.example.com/my-example-article-url-is-like.php#articlebottom
New URL Path:
http://www.example.com/my-example-article-url-is-like.php/#articlebottom
Another solution is that you'd have to delete both "www." from the domain and add a forward slash before the anchor tag in the URL/pathname before Safari would respond properly. Firefox doesn't seem to care, and I haven't gotten to testing on IE yet.
just doing my due diligence and answering for anyone who is having this problem with Index navigation links on a Squarespace page and Safari on iOS. My anchor links were not working when formatted as such:
http://sitename.com/page#anchor
Then I tried this to no avail:
http://sitename.com/page/#anchor"
Rather than give up, light my computer on fire, and call it a day I tried:
http://www.sitename.com/page/#anchor
And it worked! So cheers if this helps anyone.
I couldn't get it working with above solutions so hopefully I did my own workaround.
Purpose: Scroll to anchor "#issues" after navigating to URL "https://example.com/issues/"
Create link "https://example.com/issues?anchor=issues"
On page "https://example.com/issues" add js
<script>
if (window.location.href.search("anchor=issues") > 0) {
window.location.href= "https://example.com/issues/#issues";
}
</script>
Voila!
--
You can observe that after opening link "https://example.com/issues/#issues" Safari scrolls from anchor to the top of the page, then when you click to edit URL and hit submit button, you will be scrolled to anchor.
I hope they will fix it fast and after that they will add immediately push notification support.
Safari loses the anchor tag after redirecting. So avoid anything that leads to a (second) redirect.
use the full URL (http://...)
note if there is a redirect to www or not (www.domain...)
add a trailing / if there is no prefix like .html/.php (mypage/)
http://www.domain.tdl/mypage/#safari
Maybe it's useful to check for a redirect using tools like cURL
curl -I http://www.domain.tdl/mypage/#safari
I have been wrestling with this problem for a client of mine. I will not name names but I will share a solution I found which suddenly brought dead anchors links back to life and working on both the mobile and desktop versions of the site.
I had attributed the malfunction to an overabundance of page / site scripts and css which I can not change because while this site belongs to a local business it is part of a global corporate network which has its own protocols and best practices. In other words, I can specify inline styles to distinguish page elements but at the end of the day the page must conform to corporate guidelines and rules.
Here's a snippet of my code that embodies what I learned:
href="#anchorname" target="_top"
The key here is the target tag _top
According to http://www.w3schools.com/tags/att_a_target.asp the default target is _self and while your html generator may not write that specific bit of code into your pages which is to say that because it is the default IT DOES NOT HAVE TO BE SPECIFIED, my research has indicated that by specifying _top as the target the dead link problem was solved.
I hope this solution works for you.
There is a front-end problem in my web-app:
for example I have a page with plenty of JS code executed on that page. There is a link on it like
Examle Link
I want to click on this link before page is loaded completely and actually I can do it in FireFox. Current page stops to loading and browser redirects me to clicked link.
But in Chrome nothing happens and I have to wait until the page will be fully loaded. In other case I see in DevTools that this request got "status=cancelled"
How can I change Chrome to treat my links in other way?
Chrome users don't want to wait till page is loaded if they want to go further clicking the link...
I had read about prerendering and similar stuff but still have no ideas how to resolve it...
I would appreciate for any hints.