Attempt to fix JavaScript links: not working on relative URL

Bug reports and enhancement requests
Post Reply
NoThing
Posts: 13
Joined: Sun Dec 11, 2011 9:07 pm

Attempt to fix JavaScript links: not working on relative URL

Post by NoThing »

Hello,

I'm using NoScript 2.9.0.2 in Firefox 38.5.2ESR
I've cheked the option : in 'Advanced' > 'Untrusted' > 'Attempt to fix JavaScript links'

It does not work on this page : http://www.science20.com/ (the 4 blue text boxes, right to the main image labeled 'All featured articles')
Remark : this site is not trusted, nor marked as untrusted, in my configuration

The source of the first item gives :
<div id=\"feat-main-title\" onclick=\"javascript:window.location.href='advertising_science/blog/fda_seizes_supplements_containing_psychoactive_plant-163128';\">FDA Seizes Supplements Containing...</div>
Which should open when clicked :
http://www.science20.com/advertising_sc ... ant-163128

I thought this kind of simple link to a sub-page used to work in the past...
Is this a bug/limitation of recent versions NoScript, or is this javascript link formatted in an unusual/abnormal way ?

Edit : tried to correct the subject to : 'Attempt to fix JavaScript links: not working on relative URL'
Last edited by NoThing on Thu Jan 21, 2016 5:06 am, edited 1 time in total.
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: 'Attempt to fix JavaScript links' not working for a sub-

Post by Thrawn »

It seems strange that it's setting a href property of window.location...
And I'm not sure whether the fact that it's a relative URL presents a problem.
======
Thrawn
------------
Religion is not the opium of the masses. Daily life is the opium of the masses.

True religion, which dares to acknowledge death and challenge the way we live, is an attempt to wake up.
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:43.0) Gecko/20100101 Firefox/43.0
NoThing
Posts: 13
Joined: Sun Dec 11, 2011 9:07 pm

Re: 'Attempt to fix JavaScript links' not working for a sub-

Post by NoThing »

Thanks, I don't know much about javascript.

However an discussion about window.location.href links, with relative URL, which seems 'standard' :
http://stackoverflow.com/questions/1655 ... javascript

(I wanted to have someone else try to use these links on http://www.science20.com/ with the scripts not allowed,
because I have many other Add-Ons in Firefox that could have interferred with NoScript)
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0
barbaz
Senior Member
Posts: 11064
Joined: Sat Aug 03, 2013 5:45 pm

Re: Attempt to fix JavaScript links: not working on relative

Post by barbaz »

I went to another script-blocked page and changed this <a> element

Code: Select all

<a href="faq.html">test</a>
to this:

Code: Select all

<div onclick="window.location.href='faq.html'">test</div>
When I click on it, it gets change to this:

Code: Select all

<div onclick="window.location.href='faq.html'" href="faq.html" title="window.location.href='faq.html' null">test</div>
Click on it again does nothing.


EDIT Prepending the "javascript:" to the onclick attribute, didn't make any difference except the addition of javascript: in the title attribute.
*Always* check the changelogs BEFORE updating that important software!
-
NoThing
Posts: 13
Joined: Sun Dec 11, 2011 9:07 pm

Re: Attempt to fix JavaScript links: not working on relative

Post by NoThing »

I tried to put an ABSOLUTE URL, instead of relative URL, in the HTML code of the http://www.science20.com/ page to see if NoScript would make it clickable, but without success :

Code: Select all

<div id=\"feat-main-title\" onclick=\"javascript:window.location.href='http://www.science20.com/cool_science/your_eyes_as_radiation_detectors-162631';\">Your Eyes As Radiation Detectors </div>
I understand NS can not fix all javascript links (for pages with scripts disabled),
but the more it can fix the better of course.

So if a link like the previous one can not be fixed by NS it's better that G. Maone knows about it.
(Either be it a bug/regression in NS or simply a feature not yet added)

This said, Noscript, just before TabMixPlus, is the first extension that I install on any Firefox.
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0
barbaz
Senior Member
Posts: 11064
Joined: Sat Aug 03, 2013 5:45 pm

Re: Attempt to fix JavaScript links: not working on relative

Post by barbaz »

Moving to NoScript Development.
*Always* check the changelogs BEFORE updating that important software!
-
Post Reply