Mobile Pack resizeing background image on Web site

Nov 8, 2011 at 9:28 AM

After installing Mobile Pack a background image is getting resized on the web page.

How to resolve this issue?

Nov 8, 2011 at 11:46 AM

Hi,

The call to IsMobileModeActive() in MobileInitializationModule is most probably causing the problem. It reads a cookie to determine if image resizing should be used but the whole cookie-toggle-thingy doesn't seem to be completely implemented yet. Happy hacking! = )

BR Jens

Nov 11, 2011 at 1:41 PM
Edited Nov 16, 2011 at 8:49 AM

Been looking into this. I think there is a caching problem. In MobileInitializationModule.cs ResizeImage() the caching of the image is set to ServerNoCache - the image is cached in the server and all upcoming requests will get the rescaled image? Please correct me if I'm wrong. I changed to NoCache, and the problem seem to have gone away. But I have to test this further. There should just be client-cache for mobileuser.

Nov 24, 2011 at 5:10 AM

That is my conclusion as well. There is a cache problem.

Developer
Nov 24, 2011 at 4:50 PM

Hi guys

Thanks for the bug report, I've update the source code now to not cache images on the server. In the next version, which should be released very soon now, we're going to cache the images on disk instead.

Cheers

Frederik

Jan 12, 2012 at 9:52 AM
In MobileInitializationModule:

        private static bool IsMobileModeActive()
        {
            HttpCookie mobileToggleCookie = HttpContext.Current.Request.Cookies["mobileToggle"];

            return (mobileToggleCookie == null || mobileToggleCookie.Value.Equals("mobile", StringComparison.InvariantCultureIgnoreCase));
        }
Always returns true if the mobileToggle cookie is not set.

It should probably be:
		return (mobileToggleCookie != null && mobileToggleCookie.Value.Equals("mobile", StringComparison.InvariantCultureIgnoreCase));

But is the cookie ever set to "mobile" ?

Developer
Jan 12, 2012 at 9:55 AM

It is set to mobile when the user is browsing the normal site from a mobile device but wants to switch to the mobile site (switch between normal to mobile).

Frederik

Jan 12, 2012 at 9:57 AM
Edited Jan 12, 2012 at 10:00 AM

Yes I thought that was the purpose, but then IsMobileModeActive() doesn't work because the cookie is not set to "mobile" when browsing the mobile site. Or am I missing something?

/Niclas