Can iFrame Scrollbars be skinned in webkit? - html

It's pretty well known by now that you can style scrollbars using the webkit specific CSS tags (::-webkit-scrollbar-button:start:decrement,
::-webkit-scrollbar-button:end:increment, etc. ). However, I've noticed that I cannot style the scrollbars attached to iFrames.
Question: Is there a way to access and style the scrollbars on the iFrame using webkit? (Yes, I've actually got a particular scenario where I'd like to be able to do this.)
Thanks much in advance for any help!

The iframe scrollbars are actually part of the document inside the iframe. As a result, you have to set the scrollbar styles in the document you are loading into the iframe, not in the document that contains the iframe.

Related

iOS: Page with iframe does not scroll in WKWebView

In my app I am displaying website using the WKWebView component but since the website has <iframe> content, scrolling does not work. The iframe content itself registers taps and swipes but it never scrolls.
When I open the same page with Safari it works well, I can interact with iframe's content and scroll without any issues.
My iframe takes full width and height of the webpage and I added this property:
-webkit-overflow-scrolling: touch;
But it does not help. Unfortunately I cannot show the webpage in question because it contains proprietary data and is behing login screen.
I would prefer to solve this without having to modify the webpage, since Safari works fine.
EDIT: It looks like the iframe might be detecting the events and not "forwarding" them, because when there is also for example navbar on the page (that is not part of the iframe) I can swipe it and scroll. However since there is very little space on the screen, I would prefer not to have any other elements apart from iframe itself.
EDIT 2: I tried to display the page from iframe directly in the WKWebView but it still does not scroll at all. Works great in Safari.
Solution: In the end I solved the issue by changing the userAgent property of the WKWebView to match either iOS 12 Safari for iPhone or iPad depending on the device. The website in question is fairly complex regarding user interaction so I guess they were sending "incorrect" settings to the browser with the default user agent.
I would look for scroll-blocking event listeners that might conditionally load. If you have some kind of touch, touchmove, click, hover javascript events they might interfere with the default logic by using e.preventDefault().
Also you need to look for such events both in framed page and host page.
Try to replace a host page and framed page to see if scroll works well with different URLs.
Try placing the iframe in a div with -webkit-overflow-scrolling which takes up the full view and make the iframe the the size of it's content.
Example from: https://coderwall.com/p/c-aqqw/scrollable-iframe-on-mobile-safari
<div style="overflow:auto;-webkit-overflow-scrolling:touch">
<iframe src="./yxz" style="width:100%;height:100%">
</div>
You may have to get creative with resizing the iframe to match it's content (see: Adjust width and height of iframe to fit with content in it)

Remove min height from iFrame

I have tried to remove the min-height several ways from this iFrame. But none of them work. I can't find my answer online so I have resulted to asking the question myself.
The iFrame I'm having trouble with is on this webpage:
https://www.prolifedistribution.co.uk/procast-i103
The iFrame is the anchor embed. As you can see, you can scroll on the iframe as it has a unwanted space at the bottom. I can't leave it there and revert back to showing it, as it's just too big and I need to add other anchor iFrames underneath.
Let me know what I should try and I will see if it works.
The problem is that the content inside the iframe has a min-height value set to 300px, so thats why the scrollbar appears. Since you don't have access to Anchor's code, the only way to fix this is to disable scrolling on the iframe. One way to do this is to add the scrolling="no" attribute to the iframe. This is not valid in HTML5 though, but browsers still support it.

SVG disappear when zoom in on chrome

I've loaded a page with multiple SVGs on chrome.
when I zoomin/out one of the SVG is disappearing and I have no idea why this is happening.
(and it stays like this even when I zoom back to default)
any ideas?
this is the url if you want to try it yourself
http://www.facegift.co.il/canvas/?userItemId=17887&sc=987404&print=1&width=1500&pageNum=7
This is not a bug in Chrome. This is a bug in your page.
All the id attributes on the page have to be unique. But on your page, they are not.
The <linearGradient> for that botanical flourish has the id "SVGID_2_". There is also a <clipPath> element on the page with id="SVGID_2_".
Fix that problem (and any other duplicate ids) and I am certain things will start working.
Then you should also delete your Chrome bug report.
I had a very similar issue in Chrome because one of the elemets had the transform attribute:
transform="translate(0,-9000000000)"
And it made Chrome go crazy. The solution was to hide or remove the element.

css inheritance in iframes

I'm aware that an iframe can't inherit the css styles of the "main" webpage, but if so I am confused. I have a main page whose background is plain black, with white text. The iframe doesn't have a background colour specified and yet it is black, the same as the main page. However, other css properties in the main page have to be defined separately for the iframe if I want them to be used. Why is this?
If you do not set the background of an HTML document (by setting it on its html element or its body element), the browser default will be used, and it can be expected to be the initial value, transparent.
This means that for a page embedded in another page with the iframe element, you can expect the background of the embedding page to shine through.
You can use Developer Tools to figure out where the black background is coming from. (It's built into the browser.)
If you are using IE or Chrome, you can just press F12 on your keyboard and then use the element selector (top left) to select the IFrame. On the left you will then find all the CSS styles that are applied on that IFrame.
This will give you an insight on what's happening and also give you a new priceless tool to debug in the browser.
Note: If you use firefox, you will need to install firebug.
This can also come useful.
Precedence rules in CSS (1 is most Precedent):
User defined style
Embedded or inline style sheet
Internal style sheet
External style sheet
Browser default style
This may be Firefox specific. See here and here.

Safari Mobile iframe with inner iframe size problems

I have a "simple" web application that has a navigation and a content area.
Within the content area I have a iframe with more complex content. Unfortunately the content in the iframe has another iframe.
The get an overview look here:
.
In my scenario it is quite helpful to see the full iframe content, so we hide the navigation and change the content size on top of it:
If I go back now to initial view the iframe inside the iframe doesn't change the size:
This happend only on Safari mobile (iPad) OS 5.1. On normal Safari browser it works as expected.
Does anyone have a similar problem or an idea what is happening here?
Of course a solution would be even better :)
If this is an issue that only occurs in Safari or iPad you could add some cross-browser CSS support to tell the specific browser how it should appear. I like using this one
This allows you to add specific css instructions such as
.[os].[browser] .mylink { font-weight: bold; } -> without space between .[os] and .[browser]
.iphone.safari .scrollingframe {css style}
Hope this helps.