Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Machine: MacBook Pro (Retina, Mid 2012)
- OS: OS X Yosemite 10.10.5 (14F27)
- ## Url
- https://www.canadapost.ca/web/en/pages/parcelscon/default.page
- ## Issues
- ### Chrome
- *With Chrome the tabs (Canada, U.S., International) are un-switchable (hence one
- cannot view the data the contain). *This is now working correctly.
- Many images are clearly broken (not loaded).
- ### Firefox
- With Firefox the images are also broken (but silently) and tabbing does work.
- ## Test
- I booted up a BrowserStack machine (OSX Yosemite, Chrome 48) and there was no
- issue. I noticed that the Chrome version was Version 46.0.2490.71 (64-bit)
- however, and it was a Mac mini (Late 2012). So slightly different than my setup.
- ## Conclusions
- 1. One thing I noticed is that the images on my machine are appended with
- '_retina_en.png' where as on BrowserStack it is simply '_en.png'.
- The 'retina_en.png' and '@2x.png` images indeed, do not exist at the
- location the site is pointing to.
- 2. Clearly there is also hidden "ShareThis" functionality on the page asking for
- a key. Though this is gracefully degrading.
- 3. There is an attempt to fire the "click" event on an element that doesn't exist.
- This is likely to have been what caused the behavior I was experiencing in Chrome.
- ## Fixes
- 1. The Foundation Framework is trying to use the "retina" paths provided.
- For example:
- ```
- 538: <th class="headtitle center width25p"><a href="/web/en/products/details.page?article=priority_our_fastest"><img src="/assets/img/en/landingpages/logos/priority_en.png" data-interchange="[/assets/img/en/landingpages/logos/priority_en.png, (default)], [/assets/img/en/landingpages/logos/priority_retina_en.png, (retina)]" alt="Priority" /></a></th>
- ```
- Either get those files to the right place, or get rid of the references to them.
- 2. Remove/disable hidden "ShareThis" functionality. Or provide a "Publisher Key."
- 3. Check to see if any elements with the "hash-click" class actually exist before
- attempting to fire the "click" event.
- ```
- 950: window.onload = function () { $('.hash-click')[0].click(); }
- ```
- could be:
- ```
- window.onload = function () {
- var $hashClickElement = $('.hash-click');
- if(0 < $hashClickElement.length) {
- $hashClickElement[0].click();
- }
- }
- ```
- However it seems a bit odd that the `class` is added on `$(document).ready` and
- then "clicked" on `window.load`. One reason maybe to spread out the script load
- by finding the hash for the tab and updating the class asap, then once the entire
- page loads "click" to end up at the right position on the page without risk of
- newly loaded content "pushing down" the rest of the page. While also making sure
- the click event for the tabs are ready to go.
- The amount of work the first step takes is questionable however. It may be just
- as simple to put it all in the `window.load` handler.
- ```
- window.onload = function () {
- if(window.location.hash){
- $('dl.tabs dd a').each(function(i){
- var hash = '#' + $(this).attr('href').split('#')[1];
- if(hash == window.location.hash){
- $(this).click();
- }
- });
- }
- }
- ```
- Furthermore it is a bit strange that the line creating the hash is splitting
- out the `#`, getting the text value alone, and then adding a `#` back on again
- to perform a match...?
- It should probably be the following:
- ```
- var hash = $(this).attr('href');
- ```
- Unless there is expected to be unnecessary text before the `#` such as,
- perhaps a URL. But that doesn't seem to be the case. Take the first tab
- 'Canada' on the page. Its href is: `href="#panel2-1"` which means the
- line I provided should work. As such the variable could be completely
- eliminated anyway:
- ```
- window.onload = function () {
- if(window.location.hash){
- $('dl.tabs dd a').each(function(i){
- if($(this).attr('href') == window.location.hash){
- $(this).click();
- }
- });
- }
- }
- ```
- ## Console Output
- ### Firefox 42.0
- ```
- button.js:1 Please specify a ShareThis Publisher Key
- "NetworkError: 404 Not Found - https://www.canadapost.ca/assets/img/en/landingpages/logos/priority_retina_en.png"
- "NetworkError: 404 Not Found - https://www.canadapost.ca/assets/img/icons/check@2x.png"
- "NetworkError: 404 Not Found - https://www.canadapost.ca/assets/img/icons/extracost@2x.png"
- "NetworkError: 404 Not Found - https://www.canadapost.ca/assets/img/en/landingpages/logos/xpresspost_retina_en.png"
- "NetworkError: 404 Not Found - https://www.canadapost.ca/assets/img/en/landingpages/logos/regular_parcel_retina_en.png"
- "NetworkError: 404 Not Found - https://www.canadapost.ca/assets/img/icons/not-included@2x.png"
- "NetworkError: 404 Not Found - https://www.canadapost.ca/assets/img/en/landingpages/logos/priority_worldwide_stacked_retina_en.png"
- "NetworkError: 404 Not Found - https://www.canadapost.ca/assets/img/en/landingpages/logos/xpresspost_usa_retina_en.png"
- "NetworkError: 404 Not Found - https://www.canadapost.ca/assets/img/en/landingpages/logos/tracked_packet_retina_en.png"
- "NetworkError: 404 Not Found - https://www.canadapost.ca/assets/img/en/landingpages/logos/expedited_parcel_usa_retina_en.png"
- "NetworkError: 404 Not Found - https://www.canadapost.ca/assets/img/en/landingpages/logos/xpresspost_international_stacked_retina_en.png"
- "NetworkError: 404 Not Found - https://www.canadapost.ca/assets/img/en/landingpages/logos/international_parcel_stacked_retina_en.png"
- "NetworkError: 404 Not Found - https://www.canadapost.ca/assets/img/en/landingpages/logos/tracked_packet_international_stacked_retina_en.png"
- "NetworkError: 404 Not Found - https://www.canadapost.ca/assets/img/en/landingpages/logos/small_packet_international_stacked_retina_en.png"
- "NetworkError: 404 Not Found - https://www.canadapost.ca/assets/img/en/landingpages/logos/small_packet_usa_stacked_retina_en.png"
- TypeError: $(...)[0] is undefined
- window.onload = function () { $('.hash-click')[0].click(); }
- default.page (line 950, col 33)
- ```
- ### Chrome 46.0.2490.86 (64-bit)
- ```
- button.js:1 Please specify a ShareThis Publisher Key
- For help, contact support@sharethis.com
- https://www.canadapost.ca/assets/img/en/landingpages/logos/priority_retina_en.png Failed to load resource: the server responded with a status of 404 (Not Found)
- https://www.canadapost.ca/assets/img/icons/check@2x.png Failed to load resource: the server responded with a status of 404 (Not Found)
- https://www.canadapost.ca/assets/img/en/landingpages/logos/regular_parcel_retina_en.png Failed to load resource: the server responded with a status of 404 (Not Found)
- https://www.canadapost.ca/assets/img/en/landingpages/logos/xpresspost_retina_en.png Failed to load resource: the server responded with a status of 404 (Not Found)
- https://www.canadapost.ca/assets/img/icons/extracost@2x.png Failed to load resource: the server responded with a status of 404 (Not Found)
- https://www.canadapost.ca/assets/img/icons/not-included@2x.png Failed to load resource: the server responded with a status of 404 (Not Found)
- https://www.canadapost.ca/assets/img/en/landingpages/logos/priority_worldwide_stacked_retina_en.png Failed to load resource: the server responded with a status of 404 (Not Found)
- https://www.canadapost.ca/assets/img/en/landingpages/logos/xpresspost_usa_retina_en.png Failed to load resource: the server responded with a status of 404 (Not Found)
- https://www.canadapost.ca/assets/img/en/landingpages/logos/expedited_parcel_usa_retina_en.png Failed to load resource: the server responded with a status of 404 (Not Found)
- https://www.canadapost.ca/assets/img/en/landingpages/logos/tracked_packet_retina_en.png Failed to load resource: the server responded with a status of 404 (Not Found)
- https://www.canadapost.ca/assets/img/en/landingpages/logos/small_packet_usa_stacked_retina_en.png Failed to load resource: the server responded with a status of 404 (Not Found)
- https://www.canadapost.ca/assets/img/en/landingpages/logos/xpresspost_international_stacked_retina_en.png Failed to load resource: the server responded with a status of 404 (Not Found)
- https://www.canadapost.ca/assets/img/en/landingpages/logos/international_parcel_stacked_retina_en.png Failed to load resource: the server responded with a status of 404 (Not Found)
- https://www.canadapost.ca/assets/img/en/landingpages/logos/tracked_packet_international_stacked_retina_en.png Failed to load resource: the server responded with a status of 404 (Not Found)
- https://www.canadapost.ca/assets/img/en/landingpages/logos/small_packet_international_stacked_retina_en.png Failed to load resource: the server responded with a status of 404 (Not Found)
- default.page:950 Uncaught TypeError: Cannot read property 'click' of undefined
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement