Note that there are some explanatory texts on larger screens.

plurals
  1. POClassic ASP (JavaScript) changes the URL string being echoed
    primarykey
    data
    text
    <p>I'm trying to echo out a url in my classic ASP (JavaScript) pages. I have a little function to append a query string to the URL and echo it. My problem is that my string is being modified before being output; the protocol is changed to match the current protocol (http / https) and the subdomain is also changed (www or nothing). I don't want this to happen.</p> <p>Here's my function that I'm using to append the query string:</p> <pre><code>function writeUrl(langcode, url) { if(url.indexOf('?')==-1) { url = url + '?lang=' + langcode; } else { url = url + '&amp;amp;lang=' + langcode; } Response.Write(url); } </code></pre> <p>Pretty simple, no? This function is included in the top of the page in question like this:</p> <pre><code>&lt;!-- #include virtual="/inc_url.asp" --&gt; </code></pre> <p>Lastly, in the page itself, I call the function. The 'lang' attribute is a 2-letter string.</p> <pre><code>&lt;% writeUrl(lang, 'http://www.example.com/somepage'); %&gt; </code></pre> <p>On visiting <a href="http://example.com/somepage?lang=fr" rel="nofollow">http://example.com/somepage?lang=fr</a> I would have expected the above code to echo this:</p> <pre><code>http://www.example.com/somepage?lang=fr </code></pre> <p>However, I get any of the four following values, each one matching up with the URL I'm visiting:</p> <pre><code>Http://example.com/somepage?lang=fr https://example.com/somepage?lang=fr http://www.example.com/somepage?lang=fr https://www.example.com/somepage?lang=fr </code></pre> <p>Can anyone point out somehing I'm missing? I'd like the URL to be output without that kind of modification: I want to use it for rel=canonical.</p> <p>And no, re-writing it in .net is not a possibility.</p> <hr> <p>New information - Even the URL when hard-coded into the html, even in a comment is changed. So, if I put <code>&lt;!-- http ://www.example.com/ --&gt;</code> into the html, then when I access it from <a href="https://example.com" rel="nofollow">https://example.com</a>, it has been re-written as <code>&lt;!-- https ://example.com --&gt;</code>. This seem to confirm it's something down-stream. Any more ideas? (spaces added above so I don't exceed max number of hyperlinks).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload