[webkit-help] eBay iframe height

Paolo Portaluri poweruser.webkit at work.to.it
Mon Mar 25 05:04:01 PDT 2013


I'm sorry to post this question again, but I had no answer in a month and I really don't know what else to do :(

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 http://cl.ly/2h3x2f1l1k3v

For WebKit browsers the resizing is performed by reloading the main page adding a fragment to the URL 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 current Safari inspector 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.scrollHeight 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 due to eBay code's checks.

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 there.


Any idea on how to solve my problem?
Is this a bug of WebKit?


Ciao
Paolo


-- 
Paolo Portaluri
 web: http://work.to.it/
 AIM: poweruser82
tent: https://poweruser.tent.is




More information about the webkit-help mailing list