Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Local images with full URLs broken in Firefox 3.6 #1551

Closed
pauln opened this issue May 3, 2011 · 10 comments
Closed

Local images with full URLs broken in Firefox 3.6 #1551

pauln opened this issue May 3, 2011 · 10 comments
Assignees

Comments

@pauln
Copy link
Contributor

pauln commented May 3, 2011

If an image's src is set to a full URL, but is not from an external site, it gets rewritten incorrectly in Firefox 3.6 (actually any browser for which $.support.dynamicBaseTag is false, but that only seems to be Firefox < 4) if it's from a higher-level folder and the page is loaded via AJAX. I've built a quick example based off the list test page (http://jquerymobile.com/test/docs/lists/lists-icons.html):
Broken (AJAX loaded): http://next.gen.nz/bugs/jqm-images/#/bugs/jqm-images/icons/index.html
Working (standard HTTP load): http://next.gen.nz/bugs/jqm-images/icons/index.html

This example uses the JQuery Mobile code directly from the http://jquerymobile.com/test/ so it should be able to be used as a final test if/when a fix makes it that far.

The problem is the following replacement, on line 618 of jquery.mobile.navigation.js:
//if full path exists and is same, chop it - helps IE out
thisUrl = thisUrl.replace( location.protocol + "//" + location.host + location.pathname, "" );

The comment suggests that it is for IE's benefit, but IE doesn't run this code as $.support.dynamicBaseTag is true in IE (7+; IE6 doesn't appear to be supported by JQuery Mobile at all). Removing this line does not appear to have any negative consequences.

pauln added a commit to pauln/jquery-mobile that referenced this issue May 3, 2011
…fox 3.6)

Remove a string replacement which claims to be for IE's benefit but which doesn't even run in IE - only runs in Firefox < 4, where it breaks some images.
pauln added a commit to pauln/jquery-mobile that referenced this issue May 19, 2011
… broken in Firefox 3.6)

Change replacement URL to use path.clean( path.origin ) instead of path.get( fileUrl ) so that generated URLs are not broken (basing them off fileUrl breaks them if the page being viewed is in a different directory to path.origin).
pauln added a commit to pauln/jquery-mobile that referenced this issue Jun 20, 2011
…erly. Includes a tweak to path.get() to append a trailing slash if not present.
@toddparker
Copy link
Contributor

Is this still an open issue or did we hit this as part of the nab re-write?

@ghost ghost assigned jblas Aug 8, 2011
@pauln
Copy link
Contributor Author

pauln commented Aug 8, 2011

It doesn't seem to have been fixed - the test case in the initial issue description is still full of broken images. I'm rather behind with jquery-mobile stuff, as I've had other priorities lately, so I'll have to grab a nice clean clone and see about reimplementing the fix cleanly.

pauln added a commit to pauln/jquery-mobile that referenced this issue Aug 10, 2011
…ame so that we don't remove one prefix but add a different one
@toddparker
Copy link
Contributor

@MaxThrax - is this issue still happening in the latest build?

@agcolom
Copy link
Contributor

agcolom commented Feb 12, 2012

Hi, can someone test this in IE6 - latest? Thanks,

Anne

@agcolom
Copy link
Contributor

agcolom commented Feb 13, 2012

Ok, just tested with FF 3.5.2 on Solaris and this seems fixed (i.e. no broken images on provided test page http://next.gen.nz/bugs/jqm-images/#/bugs/jqm-images/icons/index.html ). browser details: Mozilla/5.0 (X11; U; SunOS sun4v; en-US; rv:1.9.1.2) Gecko/20090803 Firefox/3.5.2

@toddparker
Copy link
Contributor

I think this is safe to close. It checks out for @agcolom and we didn't get a reply for 5 months on this from @MaxThrax

@agcolom
Copy link
Contributor

agcolom commented Feb 13, 2012

Agreed :-)

@klodeckl
Copy link

Please reopen bug, this is still not solved. I just tested the two links from pauln in Firefox 17.0.1 and Safari 6.0.2 on Mac OS and the bug is still there.
I develop a site a have currently the same issue. Link is coming from a CMS.

@klodeckl
Copy link

I fixed the issue in my case. I just wanted to remove the part of the url like Domain etc. with the following script:
$('img[src_="typo3temp/"][src_="http://domain.tld/"]').each(function (i,v) {
$(this).attr('src',$(this).attr('src').substr(simpleString.indexOf('typo3temp/'));
});

But when I use this snippet, the URL in the browser window is changing, the anchor gets removed (like in the docs: http://jquerymobile.com/demos/1.2.0/). Before I had this, the anchor was not removed which I think caused the error. So I wanted to solve the problem afterwards by correcting the src urls but I corrected it another way (anchor gets removed right). I don’t know why, but it works. The JS command does not do anything with the browsers url, is this in conjunction with jqm?

@klodeckl
Copy link

In my previous post, there was an error in my script, that was the reason of that behaviour it worked and the anchor got removed.

Here my running script:

$('div:jqmData(role="page")').live('pagebeforeshow',function(){
$('img[src_="typo3temp/"][src_="http://mobileapp.haw-aw.de/"]').each(function (i,v) {
$(this).attr('src',$(this).attr('src').substr($(this).attr('src').indexOf('typo3temp/')));
});
});

This makes my absolute URLs from the CMS relative and it works. But the problem itself in jQuery mobile should be checked itself. I think it is concerned to the anchor in the browser url. Why does the anchor get removed at the docs (http://jquerymobile.com/demos/1.2.0/) and in my case not? Which behaviour is right?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants