![]() Topic awaiting preservation: relative paths into absolute paths (Page 1 of 1) |
|
---|---|
Paranoid (IV) Inmate From: Seattle, WA, USA |
![]() OK, so on this page I include a page from another site via php's readfile(). And a lot of the images and links are broken because they are relative paths (/images/images.gif instead of http://www.domainname.com/images/images.gif, same deal with links) Would there be a way in JS to change all the relative paths to absolute paths? |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
![]() If you are able to insert text into the page this doesn't actually take Javascript |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
![]() You could probably use this JS code, but it wouldn't take effect until the page has loaded: |
Paranoid (IV) Inmate From: Seattle, WA, USA |
![]() Hmm, interesting. Is there a way to get what's in the address bar. Because then you could just erase everything on the end until a slash and then append the relative link and then that'd work for those links that are relative to the page. |
Paranoid (IV) Inmate From: Den Haag, Netherlands |
![]() It's early in the morning, I'm at work, hassled and thinking on my feet, so apologies if this is a stupid answer ... but ... while you're still in the PHP part of the process, couldn't you either add the base address to the header (as bitdamaged suggests) ... |
Paranoid (IV) Inmate From: Seattle, WA, USA |
![]() If I knew how to do the base thing with php I would. I'll go look for it now, but I've never heard of it. |
Maniac (V) Mad Scientist From: 100101010011 <-- right about here |
![]() There's not so much a base thing in php |
Paranoid (IV) Inmate From: Seattle, WA, USA |
![]() Hey, |