Problem with Javascript code in Firefox

User Help for Mozilla Firefox
Post Reply
Ronas
Posts: 5
Joined: April 4th, 2019, 7:53 am

Problem with Javascript code in Firefox

Post by Ronas »

Hi

The following code doesn't work in Firefox on bookmarks Toolbar but works in chrone (Add page)


http://uupload.ir/files/fx8c_ggh.jpg


Code: Select all

javascript:(function(){ var e,s; IB=1; function isDigit(c) { return ("0" <= c && c <= "9") } L = location.href; LL = L.length; for (e=LL-1; e>=0; --e) if (isDigit(L.charAt(e))) { for(s=e-1; s>=0; --s) if (!isDigit(L.charAt(s))) break; break; } ++s; if (e<0) return; oldNum = L.substring(s,e+1); newNum = "" + (parseInt(oldNum,10) + IB); while (newNum.length < oldNum.length) newNum = "0" + newNum; location.href = L.substring(0,s) + newNum + L.slice(e+1); })();
User avatar
DanRaisch
Moderator
Posts: 127231
Joined: September 23rd, 2004, 8:57 pm
Location: Somewhere on the right coast

Re: Problem with Javascript code in Firefox

Post by DanRaisch »

Moving to Firefox Support.
User avatar
jscher2000
Posts: 11762
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA
Contact:

Re: Problem with Javascript code in Firefox

Post by jscher2000 »

Is there any error message in the Browser Console? https://developer.mozilla.org/docs/Tool ... er_Console
User avatar
therube
Posts: 21714
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Re: Problem with Javascript code in Firefox

Post by therube »

Works on my end.
Increments the "digit" in a URL.
May or may not be meaningful, depending on the page you're on.

URL:

Code: Select all

https://www.google.com/search?q=uniplex+word+processor&tbm=isch&source=univ&client=firefox-b-1-d&sa=X&ved=2ahUKEwjux9CdjJPhAhVJvFkKHdSWDFkQsAR6BAgGEAE&biw=1920&bih=1008
Each time you click the bookmarklet, the "bih=" number increments.
Now what the "bih=" number signifies, no idea, but the number does change (though the actual page contents do not - though you will see a "refresh").


Now other extensions, setting may interfere.
NoScript does - unless you Allow the site you're running the bookmarklet on.
10: Bookmarklets Don't Work unless Site is Allowed


In the good old days, there used to be an extension, URL Flipper.
Alas, that ship has sailed.
Fire 750, bring back 250.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript
morat
Posts: 6421
Joined: February 3rd, 2009, 6:29 pm

Re: Problem with Javascript code in Firefox

Post by morat »

Post Reply