Absolute links on hml page in local directory not working
All the absolute links on my html pages (which are on my hardrive) are being treated as local links and are therefore not working - i.e. Firefox is adding the local file path before the url. For example, the original link is: http://www.insidehousing.co.uk/legal/criminal-conviction-for-illegally-subletting-tenant/6518844.article
But Firefox is adding the directory path so the url string becomes: /www.insidehousing.co.uk/legal/criminal-conviction-for-illegally-subletting-tenant/6518844.article%E2%80%9D
It is also being appended with: %E2%80%9D (which, when tested from a Word page, leads to site but generates page not found error).
For testing purposes, is there any way I can reconfigure Firefox to parse my links as absolute?
Many thanks
由blue88于
被采纳的解决方案
Hey blue88,
A quick look through the code shows < a href= & # x201d; Which won't work. Here is a fixed version of your page. To prevent this from happening again, I suggest you use a text editor with syntax highlighting, such as Notepad++.
定位到答案原位置 👍 0所有回复 (10)
I've just tested his using:
<a href="http://www.insidehousing.co.uk/legal/criminal-conviction-for-illegally-subletting-tenant/6518844.article">Test</a>
Seems to be working fine on my end. Perhaps you could provide a snippet of the problem code so we can help?
Seems to be adding Unicode quotes (%E2%80%9D; ”): ”http://www.insidehousing.co.uk/legal/criminal-conviction-for-illegally-subletting-tenant/6518844.article”
Is this when testing code locally, possibly from within an HTML editor or with the web based version?
I also notice that Related links have a double "//" in them:
Reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
- Press and hold Shift and left-click the Reload button.
- Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
- Press "Command + Shift + R" (MAC)
@yalam96: Please see the attached screenshot, where I've marked one of the affected links and it's prefixed url at the bottom of the screen in Fire Fox. I created the html originally in CSE pro V12 beta 5, although have since used Notepad. In Notepad, the link is shown as <a href=”http://www.insidehousing.co.uk/legal/criminal-conviction-for-illegally-subletting-tenant/6518844.article”>prosecute</a> (no prefix). Please get back to me if you need any more e.g.s etc. Thanks
由cor-el于
Forgot to mention I've also tested this in IE and Safari (on another machine). URL is still being pre-fixed with the local file path. Also tried changing from unicode to western with no effect.
I believe you might have an extra quotation mark somewhere in the HTML. If you could attach the .html page, I could look over any errors for you.
You have the wrong quotes in that HTML code: ” (”) instead of " (")
<a href=”http://www.insidehousing.co.uk/legal/criminal-conviction-for-illegally-subletting-tenant/6518844.article”
Thanks, both. I have carried out cor-el's suggestion of replacing the smart quotes with dumb quotes, then tried viewing link on file again using different encoading, including UTF-16 - same result as before.
Below I've set the HTML of the whole page, as per yalam96's request (it includes cor-el's suggested fix to the "prosecute" link):
<h3>Who do you need to inform (in the UK)?</h3> <p>If you have a mortgage, you will need to inform your provider (with most lenders this shouldn't be an issue – you do not need “consent to let” as you would if you were letting out the whole property) but you do still need to inform them; why? This is partly for the protection of your lodger, if you should default on the mortgage or die, but mostly for your own protection – if the property was destroyed or badly damaged because of the negligence of your lodger.</p> <p>If own your property and it's leasehold, check the lease – you may need permission from the freeholder.</p> <p>If you rent your property, you will need to firstly check with your landlord (this applies whether you rent privately or from a public landlord – Local Authority or Housing Association), and get their permission in writing, just as you would with a mortgage provider. Incidently, in the UK, a public landlord is only likely to object to the let if moving a lodger in would mean your home becomes over crowded (e.g. you have a two bed flat and your children would have to share your bedroom). They will also object – they might even <a href=”http://www.insidehousing.co.uk/legal/criminal-conviction-for-illegally-subletting-tenant/6518844.article">prosecute</a> - if you move out and let the whole property to the “lodger” (who wouldn't be a lodger in that case, but a full tenant, with full tenant's rights).</p> <p>You may also need to cancel any existing residential home insurance and take out <a href=”http://www.landlordinsurance.biz/landlord-insurance-guides/landlord-insurance-faq/”>landlord insurance</a>. A few residential policies will, however, allow lodgers. Landlord insurance will not cover the lodger's possessions, they will need to get their own insurance, known as Tenant Insurance – policies can be compared on sites such as <a href=”http://www.confused.com/campaign/home-insurance/tenants-content-insurance?MediaCode=1054&kw=lodger+contents+insurance+broad&gclid=CPbbn9-Nj7MCFanItAod3GAAog”>confused.com</a></p> <p>If you get a single occupier's discount on your council tax, you will need to inform your local authority, unless your lodger is <a href=”https://www.gov.uk/council-tax/council-tax-exemptions”>exempt</a> from paying council tax (e.g. they're a university student).</p> <p>NB People claiming Jobseeker's Allowance and most other benefit claimants are <b>not</b> exempt – they are, however, usually entitled to Council Tax Benefit to help with some or all the cost of their council tax.</p> <p>If you're letting on a Monday – Friday basis (to someone who only needs a week night let), this person would not normally pay council tax at your property, as they already pay against their main (family) home. However, if for whatever reason you and your Monday – Friday lodger decided that they would use your address as their main home, they would then become liable to pay council tax at your address and you would lose any single occupier's discount.</p> <p>If you claim any kind of means tested benefit (such as job seeker's allowance, housing benefit or council tax benefit) as benefit rules currently stand (January 2013) your rental income will affect this. <b>Contribution</b> based Job Seeker's allowance (JSA(C)) will be affected if your weekly rental income exceeds £50. If you're on income based jobseeker's allowance (JSA(I)), it's very likely to be affected; however, to what extent will depend on your rental earnings and circumstances and a DWP adjudicator will decide this.</p> <p>However, from October 2013, when Universal Credit takes effect in the UK, <a href=”http://www.insidehousing.co.uk/tenancies/lodger-rules-to-ease-impact-of-bedroom-tax/6522846.article?MsgId=57059”>a <b>public housing</b> tenant's income from renting a room will no longer affect their benefit entitlement.</a></p>
由cor-el于
选择的解决方案
Hey blue88,
A quick look through the code shows < a href= & # x201d; Which won't work. Here is a fixed version of your page. To prevent this from happening again, I suggest you use a text editor with syntax highlighting, such as Notepad++.
由Yousef于
This one is wrong (has HTML entity codes):
<a href=”http://www.insidehousing.co.uk/legal/criminal-conviction-for-illegally-subletting-tenant/6518844.article">
Should be:
<a href="http://www.insidehousing.co.uk/legal/criminal-conviction-for-illegally-subletting-tenant/6518844.article">
All other links also still have the wrong Unicode quotes (”) instead of normal quotes (") in the href attribute:
<a href=”http://www.landlordinsurance.biz/landlord-insurance-guides/landlord-insurance-faq/”> <a href=”http://www.insidehousing.co.uk/tenancies/lodger-rules-to-ease-impact-of-bedroom-tax/6522846.article?MsgId=57059”> <a href=”http://www.confused.com/campaign/home-insurance/tenants-content-insurance?MediaCode=1054&kw=lodger+contents+insurance+broad&gclid=CPbbn9-Nj7MCFanItAod3GAAog”> <a href=”https://www.gov.uk/council-tax/council-tax-exemptions”>
Should be:
<a href="http://www.landlordinsurance.biz/landlord-insurance-guides/landlord-insurance-faq/"> <a href="http://www.insidehousing.co.uk/tenancies/lodger-rules-to-ease-impact-of-bedroom-tax/6522846.article?MsgId=57059"> <a href="http://www.confused.com/campaign/home-insurance/tenants-content-insurance?MediaCode=1054&kw=lodger+contents+insurance+broad&gclid=CPbbn9-Nj7MCFanItAod3GAAog"> <a href="https://www.gov.uk/council-tax/council-tax-exemptions">
You can do a replace to change ” to " in the text editor.
由cor-el于
The responses above are correct. It was my first time in many years doing any web coding, and I used a word processing program for the first draft of my web content. What I didn't appreciate was that the word processing program would add markup to the hypertext links, making them unreadable in a web browser.