Email conversation
From | Mary E. Daniel |
To | Me |
Subject | %5C in URL |
Date | 30 August 2005 15:47 |
Hello,
I've been searching around the web for a solution to this prob & I see
you've addressed it previously, but since I'm not a programmer, I don't
really understand how to apply your answer to my particular problem.
I'm trying to place a URL inside some JS I've been using for quite a while
to pop up links in the same window & make that window regain the focus when
a new link opens in it. It usually works like a charm.
Here is the JS...
function popupLink(url) {
popLink =
window.open(url,'popLink','menubar=yes,location=yes,scrollbars=yes,status=ye
s,titlebar=yes,toolbar=yes,resizable=yes,width=790,height=405,left=0,top=25'
);
self.popLink.focus();
}
The URL I'm having problems with contains the %5C which I guess is a
directive down into a folder on a drive. When not in the JS, the link seems
to work fine in both IE & Netscape7.0. But, when inside the JS, I just
can't make it work in either browser. Any suggestions?
Here is the link...
http://www.example.com/portal/a/c/s/1/acsdisplay.html?DOC=minorityaffairs%5Cscholars.html
Thanks!
Mary E.
From | Me |
To | Mary E. Daniel |
Subject | Re: %5C in URL |
Date | 30 August 2005 18:15 |
Mary,
> When not in the JS, the link seems
> to work fine in both IE & Netscape7.0. But, when inside the JS, I just
> can't make it work in either browser. Any suggestions?
Well, assuming that it is normally on one line (I think your email client
broke the line), it looks like it should work in both cases. This is
assuming this is a requested popup (did you click something in order to open
it) - if it is unrequested, then it is almost certainly a popup blocker
blocking it.
Please try it in Opera:
http://www.opera.com/download/
and tell me any error messages that turn up in Opera's error console (tools
- advanced - javascript console), and also tell me if Opera says that it
blocked any popups on the page. That should help me diagnose the problem.
At the same time, could you give me the address of the page where you are
actually trying to use the script (not the page you are trying to open), so
I can see the rest of the code you are using.
Mark 'Tarquin' Wilton-Jones - author of http://www.howtocreate.co.uk/
From | Mary E. Daniel |
To | Me |
Subject | Re: %5C in URL |
Date | 30 August 2005 19:01 |
I swapped out the %5C for an actual / and that seems to work in both IE &
Netscape7.0.
Here's the link to the actual pg I'm building. It's the first Scholarship
link in the list (for American Chemical Society). I've put 3 links to test:
one using JS and %5C, one using JS and a /, and one without JS. The 2nd and
3rd links work for me, but not the 1st.
http://example.com/links/resource_center/ssa_outschol_highschool.shtml
Haven't had a chance to test out with Opera.
Thanks for you assistance!
Mary E.
From | Me |
To | Mary E. Daniel |
Subject | Re: %5C in URL |
Date | 30 August 2005 19:47 |
Mary,
> I swapped out the %5C for an actual / and that seems to work in both IE &
> Netscape7.0.
%5C is a \ not a /
that is beside the point, but here is your problem. The browsers decode %xx
characters in JavaScript URLs so they are interpreting it as
minorityaffairs\scholars.html which reads as an escaped 's' - in strings
this is not a standard escape character, so the escape character is
effectively ignored, and you are left with minorityaffairsscholars.html
The correct way to write a \ in a JavaScript string is \\ - just like /
should be written as \/
> Haven't had a chance to test out with Opera.
Please do. Because although your window opening script should work in Opera,
Safari, Konqueror and iCab, your menu script (HierMenus) is out of date and
needs to be upgraded, because it is needlessly blocks Opera 8. Please
[upgrade your copy of] HierMenus:
http://www.hiermenuscentral.com/
From | Mary E. Daniel |
To | Me |
Subject | Re: %5C in URL |
Date | 30 August 2005 21:56 |
>The correct way
Extra cool!!! I made the change to \\ and that works!
> [upgrade your copy of] HierMenus:
Unfortunately, as I say, I'm not a programmer so I don't know how to make a
new menu using JS. We originally hired out to have our site done and that
person made our menu. We'll probably be having some major updates done to
the site within the next 12 months probably by a real programmer (or
changing out the JS menus anyway) and I'll point out your information.
[Ed. note: upgrading HierMenus is usually as easy replacing one or two
files - it does not take 12 months]
Thanks bunches!!
Mary E.