Problem with an ampersand in XUL
Moderator: trava90
Forum rules
This board is for technical/general usage questions and troubleshooting for the Pale Moon browser only. The main focus here is on Pale Moon on Windows. Please direct your questions that are specific for Linux and Mac to the dedicated boards for those operating systems.
Technical issues and questions not related to the Pale Moon browser should be posted in other boards!
Please keep off-topic and general discussion out of this board, thank you!
This board is for technical/general usage questions and troubleshooting for the Pale Moon browser only. The main focus here is on Pale Moon on Windows. Please direct your questions that are specific for Linux and Mac to the dedicated boards for those operating systems.
Technical issues and questions not related to the Pale Moon browser should be posted in other boards!
Please keep off-topic and general discussion out of this board, thank you!
- back0rifize
- Moonbather

- Posts: 51
- Joined: 2016-05-08, 02:26
Problem with an ampersand in XUL
Hello!
Today I've faced the problem: I created a file, called "about.xul". In this file, I placed a link to my forum's profile. And now, when I try to call this XUL, PM tells me, that I have a syntax error issue.
I'm sure, that an ampersand is the cause of problem, because if I replace it with any other symbol, It seems to be alright.
Today I've faced the problem: I created a file, called "about.xul". In this file, I placed a link to my forum's profile. And now, when I try to call this XUL, PM tells me, that I have a syntax error issue.
I'm sure, that an ampersand is the cause of problem, because if I replace it with any other symbol, It seems to be alright.
- New Tobin Paradigm
- Knows the dark side

- Posts: 8884
- Joined: 2012-10-09, 19:37
- Location: Seriphia Galaxy
Re: Problem with an ampersand in XUL
In XML the ampersand is a special char.. To use an ampersand literal in an element or attr you can use the entity form:
Though if it is not inside an attr but just enclosed in an element you can also use CDATA but this is easier. XML is always strict in processing the markup so unlike most forms of HTML there isn't any kind of quirks mode in the rendering engine or whatnot.
Code: Select all
&- back0rifize
- Moonbather

- Posts: 51
- Joined: 2016-05-08, 02:26
Re: Problem with an ampersand in XUL
Strange, I thought that the "quotes" must disable any special chars and wrap them into the simple literal symbols
...
And so we have another problem: if "&" change to "&", this link will be broken. I mean, this forum does not parse this link.
Of course, I can code a little script and then all will be alright, but I want to know, why this suppose to be?
And so we have another problem: if "&" change to "&", this link will be broken. I mean, this forum does not parse this link.
Of course, I can code a little script and then all will be alright, but I want to know, why this suppose to be?
- New Tobin Paradigm
- Knows the dark side

- Posts: 8884
- Joined: 2012-10-09, 19:37
- Location: Seriphia Galaxy
Re: Problem with an ampersand in XUL
Try using this instead..
Code: Select all
%26- back0rifize
- Moonbather

- Posts: 51
- Joined: 2016-05-08, 02:26
Re: Problem with an ampersand in XUL
Believe me, I've already tried this too with no result
. Thank you.
Re: Problem with an ampersand in XUL
No, it will not.back0rifize wrote:And so we have another problem: if "&" change to "&", this link will be broken.
- New Tobin Paradigm
- Knows the dark side

- Posts: 8884
- Joined: 2012-10-09, 19:37
- Location: Seriphia Galaxy
Re: Problem with an ampersand in XUL
JustOff it depends on the browser and server software. I have ran into this my self.. However, the %26 SHOULD work...
Well maybe you should just assign the attr using js instead.
Well maybe you should just assign the attr using js instead.
Re: Problem with an ampersand in XUL
Maybe in some cases something might go wrong, but I checked that in the about.xul file in the Calendate extension in question, & works as expected.
Re: Problem with an ampersand in XUL
This forum blocks URLs with "&" as a literal string in the URL to mitigate bot abuse - most websites do not.
"Son, in life you do not fight battles because you expect to win, you fight them merely because they need to be fought." -- Snagglepuss


Re: Problem with an ampersand in XUL
There will be no "&" in the forum URL, because when it's used in the "href" attribute of the "label" element in the "about.xul", it becomes "&" when the link is opened.
- back0rifize
- Moonbather

- Posts: 51
- Joined: 2016-05-08, 02:26
Re: Problem with an ampersand in XUL
Other words, I was right that neither "&" nor "%26" will not work? In my case this is right what exactly happened.Moonchild wrote:This forum blocks URLs with "&" as a literal string in the URL to mitigate bot abuse - most websites do not.
With all my respect, but it's not working. Maybe I'm dumb?JustOff wrote:There will be no "&" in the forum URL, because when it's used in the "href" attribute of the "label" element in the "about.xul", it becomes "&" when the link is opened.
One way or the other, I've done an update yesterday, and simply remove this profile link completely. I didn't include a JS-file in "About XUL", because the only reason, why I have no desire in doing it - is include yet another JS only for solving such kind of a situation. It's better to abandon an idea, than to use a complex way to solve a simple problem.
Think, this topic may be closed. Thanks to all for your answers!
- New Tobin Paradigm
- Knows the dark side

- Posts: 8884
- Joined: 2012-10-09, 19:37
- Location: Seriphia Galaxy
Re: Problem with an ampersand in XUL
You can add javascript directly to XUL and if you CDATA the contents of the script tag you can add that one onload function to add the attr. It just isn't best practice to do js in xul files in-line but know what.. I don't have a problem for a one off workaround..
- back0rifize
- Moonbather

- Posts: 51
- Joined: 2016-05-08, 02:26
Re: Problem with an ampersand in XUL
Yeah, I know about CDATA, and I've already used it in previous versions (below 3.0, Firefox only). Since I've ported my add-on to PM, I use a links to a JS-files with a window.addEventListener(); instead for more clearance.
Re: Problem with an ampersand in XUL
No, you're not right. I'm only saying that if your code does a request to the forum server with "&" as a literal string in the URL, it will be refused. I didn't say anything about %26, nor did I say anything about how it's specifically handled in your situation or what is sent to the server -- just providing information that might save you some troubleshooting IF you're sending "&" in your URLs for some reason!back0rifize wrote:Other words, I was right that neither "&" nor "%26" will not work? In my case this is right what exactly happened.
"Son, in life you do not fight battles because you expect to win, you fight them merely because they need to be fought." -- Snagglepuss


Re: Problem with an ampersand in XUL
Please check your PM.back0rifize wrote:With all my respect, but it's not working.
- back0rifize
- Moonbather

- Posts: 51
- Joined: 2016-05-08, 02:26
Re: Problem with an ampersand in XUL
Problem solved, thank you, JustOff!JustOff wrote:Please check your PM.
- New Tobin Paradigm
- Knows the dark side

- Posts: 8884
- Joined: 2012-10-09, 19:37
- Location: Seriphia Galaxy
Re: Problem with an ampersand in XUL
Mind sharing this solution?
Re: Problem with an ampersand in XUL
Tobin, your initial advice to use "&" was absolutely correct, I just applied it to the back0rifize's extension and sent him the result. I guess he simply made a typo somewhere when previously reported a failure.
- New Tobin Paradigm
- Knows the dark side

- Posts: 8884
- Joined: 2012-10-09, 19:37
- Location: Seriphia Galaxy
Re: Problem with an ampersand in XUL
No, that isn't smoke, it's steam. Steam from the steamed clams we're having. Mmmm, steamed clams!
Re: Problem with an ampersand in XUL
Yep. The Aurora Borealis. At this time of year. At this time of day. In this part of the country. Localized entirely within your kitchen.


