[webkit-help] eBay iframe height
Paolo Portaluri
poweruser.webkit at work.to.it
Thu Feb 14 12:23:35 PST 2013
I'm having a problem with my HTML listing on eBay.
eBay loads the HTML code provided by the user for their item's description in an iframe in the item page.
Immediately after loading the iframe, a JavaScript function is called to resize the frame so it fit the content.
My problem is that the resize doesn't work properly in desktop WebKit browsers.
Here's one of my listing having the problem: http://cgi.ebay.it/ws/eBayISAPI.dll?ViewItem&item=120928779644
(The first time I load the page, eBay looks weird and don't shows the problem, but it appears in the next reload. It seems a cookie related problem).
I tried with:
* Safari 6.0.2 (8536.26.17) on Mac OS X 10.8.2,
* SRWare Iron (based on Chromium) 24.0.1350.0 (178923) on Mac OS X 10.8.2,
* Up-to-date Chrome on Windows XP.
In every cases, the iframe height is too small to accommodate its content.
Related side-notes:
* It works on Internet Explorer 8 on Windows XP and Mobile Safari on iPad iOS 6.0.1.
* With Firefox (on Mac and Win) the iframe height is enormously big.
This is what I found in my search for a solution to this problem:
The iframe code is structured this way:
1. eBay's html, head, body tags
2. eBay's JavaScript code 1
3. eBay's table and div tags
4. User's HTML code (with CSS e JS)
5. eBay's closing tags for 3.
6. eBay's JavaScript code 2
7. eBay's closing tags for 1.
An example with bogus user code and beautified JS code is here https://gist.github.com/poweruser82/4955463
For WebKit browser the resizing is done by reloading the main page adding to the URL a fragment with the desired size.
The height to be used is calculated by the function ifr.getSize() (cfr. https://gist.github.com/poweruser82/4955463#file-ebay_iframe_clean-L315 ).
Debugging the code in SRWare Iron (mostly because Safari can't beautify the code :[), I found the problem is at line 330 https://gist.github.com/poweruser82/4955463#file-ebay_iframe_clean-L330 where it says:
> h = document.body.offsetHeight;
The value returned by WebKit is 500 on my Mac instead of a little less than 1500.
document.body.offsetHeight returns the correct value.
If I force the h variable in the debug session, the frame is resized correctly.
I tried to tweak the ifr object in my code, but eBay's code (at step 6) redefines it, so trying to freeze the object was useless.
If I try to reload the parent page after a delay passing the fragment with the right size, nothing happens.
To add more doubts to the situation, the problem didn't happen in other listing (i.e.: http://www.ebay.it/itm/CASE-AEROCOOL-VX-E-PRO-ADVANCE-BLACK-CABINET-PC-GAMING-CON-CONTROLLER-VENTOLE-/251084074821 ).
I analysed its code but I haven't found any clue because document.body.offsetHeight return the right value here.
Any idea on how to solve my problem?
Is this a bug in WebKit?
Ciao
Paolo
--
Paolo Portaluri
web: http://work.to.it/
tent: https://poweruser.tent.is
More information about the webkit-help
mailing list