django-responsive icon indicating copy to clipboard operation
django-responsive copied to clipboard

JS reload causes issues

Open svleeuwen opened this issue 10 years ago • 1 comments

The document.reload call causes some issues.

  1. Referrer information isn't interpreted correctly in Google Analytics. (organic traffic is measured as direct)
  2. Google PageSpeed Insights raises a 'too many redirects' error.

I've fixed this in my fork by removing the reload call and using a default 'type' if width is None. But this feels a bit like a workaround. And because I use 'desktop' as default type it will load desktop images on mobile devices on the first load.

Maybe you have some ideas?

svleeuwen avatar May 23 '14 11:05 svleeuwen

Honestly GA problems were something that I hadn't considered when making this but that would obviously be a problem. Letting the first page load go through without the information is a reasonable work-around if you understand the implications. As you noted the first page load will potentially show for the wrong type. Given the importance of first impressions that's what lead me to reload the page in the first place.

I suppose something could be done to only redirect if the width would map to a non-default size but that would still cause some problems and it might be difficult to pass that information (i.e what is the default) to the JS code.

No brilliant solution comes to mind but it's an interesting problem to address.

mlavin avatar May 23 '14 12:05 mlavin