How to run javascript in Mozilla URL bar?












4















I am using mozilla and trying to run this code on the url bar javascript:alert(document.cookie); but when I hit go, nothing happens. But in chromium, it alerts, so what is with the firefox? does firefox enters http by default. If this, then How do I prevent this?










share|improve this question





























    4















    I am using mozilla and trying to run this code on the url bar javascript:alert(document.cookie); but when I hit go, nothing happens. But in chromium, it alerts, so what is with the firefox? does firefox enters http by default. If this, then How do I prevent this?










    share|improve this question



























      4












      4








      4








      I am using mozilla and trying to run this code on the url bar javascript:alert(document.cookie); but when I hit go, nothing happens. But in chromium, it alerts, so what is with the firefox? does firefox enters http by default. If this, then How do I prevent this?










      share|improve this question
















      I am using mozilla and trying to run this code on the url bar javascript:alert(document.cookie); but when I hit go, nothing happens. But in chromium, it alerts, so what is with the firefox? does firefox enters http by default. If this, then How do I prevent this?







      firefox javascript






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 14 '13 at 9:36







      user212806

















      asked Nov 14 '13 at 9:14









      user212806user212806

      42115




      42115






















          2 Answers
          2






          active

          oldest

          votes


















          2














          Firefox 57 and later




          1. Select Settings menu (3 horizontal lines icon in upper right corner) -> Web Developer -> Scratchpad.


          2. Click the Run button on the Scratchpad toolbar to run your JavaScript code.





          Firefox 56 and earlier




          1. Open a new tab in Firefox and in the URL bar, and enter about:blank to display a blank tab so that you can see what you are doing.


          2. From the Firefox menu select Tools -> Web Developer -> Web Console.


          3. A new Web Console window will open. From the Web Console window click the JS button on the toolbar.


          4. From the Web Console window click on the Scratchpad icon in the toolbar. The Scratchpad icon looks like a notepad.


          5. A new Scratchpad window will open. Copy your javascript code: javascript:alert('Hello, World') in the Scratchpad window.


          6. Click the Run button on the Scratchpad toolbar to run your JavaScript code.







          share|improve this answer

































            4














            For firefox android version, you can try this bookmarklet:



            javascript:var a=prompt();var f=Function(a);f();



            It will open a prompt box. Type your command in it (without "javascript:") and it will run.






            share|improve this answer


























            • I'm on desktop Linux, but this worked for me: javascript:var a=function(){ alert(prompt()); }(). (Edit - added 'alert' around 'prompt' to show use of the output.)

              – John P
              Aug 14 '17 at 18:57













            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "89"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f376839%2fhow-to-run-javascript-in-mozilla-url-bar%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            Firefox 57 and later




            1. Select Settings menu (3 horizontal lines icon in upper right corner) -> Web Developer -> Scratchpad.


            2. Click the Run button on the Scratchpad toolbar to run your JavaScript code.





            Firefox 56 and earlier




            1. Open a new tab in Firefox and in the URL bar, and enter about:blank to display a blank tab so that you can see what you are doing.


            2. From the Firefox menu select Tools -> Web Developer -> Web Console.


            3. A new Web Console window will open. From the Web Console window click the JS button on the toolbar.


            4. From the Web Console window click on the Scratchpad icon in the toolbar. The Scratchpad icon looks like a notepad.


            5. A new Scratchpad window will open. Copy your javascript code: javascript:alert('Hello, World') in the Scratchpad window.


            6. Click the Run button on the Scratchpad toolbar to run your JavaScript code.







            share|improve this answer






























              2














              Firefox 57 and later




              1. Select Settings menu (3 horizontal lines icon in upper right corner) -> Web Developer -> Scratchpad.


              2. Click the Run button on the Scratchpad toolbar to run your JavaScript code.





              Firefox 56 and earlier




              1. Open a new tab in Firefox and in the URL bar, and enter about:blank to display a blank tab so that you can see what you are doing.


              2. From the Firefox menu select Tools -> Web Developer -> Web Console.


              3. A new Web Console window will open. From the Web Console window click the JS button on the toolbar.


              4. From the Web Console window click on the Scratchpad icon in the toolbar. The Scratchpad icon looks like a notepad.


              5. A new Scratchpad window will open. Copy your javascript code: javascript:alert('Hello, World') in the Scratchpad window.


              6. Click the Run button on the Scratchpad toolbar to run your JavaScript code.







              share|improve this answer




























                2












                2








                2







                Firefox 57 and later




                1. Select Settings menu (3 horizontal lines icon in upper right corner) -> Web Developer -> Scratchpad.


                2. Click the Run button on the Scratchpad toolbar to run your JavaScript code.





                Firefox 56 and earlier




                1. Open a new tab in Firefox and in the URL bar, and enter about:blank to display a blank tab so that you can see what you are doing.


                2. From the Firefox menu select Tools -> Web Developer -> Web Console.


                3. A new Web Console window will open. From the Web Console window click the JS button on the toolbar.


                4. From the Web Console window click on the Scratchpad icon in the toolbar. The Scratchpad icon looks like a notepad.


                5. A new Scratchpad window will open. Copy your javascript code: javascript:alert('Hello, World') in the Scratchpad window.


                6. Click the Run button on the Scratchpad toolbar to run your JavaScript code.







                share|improve this answer















                Firefox 57 and later




                1. Select Settings menu (3 horizontal lines icon in upper right corner) -> Web Developer -> Scratchpad.


                2. Click the Run button on the Scratchpad toolbar to run your JavaScript code.





                Firefox 56 and earlier




                1. Open a new tab in Firefox and in the URL bar, and enter about:blank to display a blank tab so that you can see what you are doing.


                2. From the Firefox menu select Tools -> Web Developer -> Web Console.


                3. A new Web Console window will open. From the Web Console window click the JS button on the toolbar.


                4. From the Web Console window click on the Scratchpad icon in the toolbar. The Scratchpad icon looks like a notepad.


                5. A new Scratchpad window will open. Copy your javascript code: javascript:alert('Hello, World') in the Scratchpad window.


                6. Click the Run button on the Scratchpad toolbar to run your JavaScript code.








                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 23 at 9:38

























                answered Nov 14 '13 at 9:33









                karelkarel

                59.3k13128151




                59.3k13128151

























                    4














                    For firefox android version, you can try this bookmarklet:



                    javascript:var a=prompt();var f=Function(a);f();



                    It will open a prompt box. Type your command in it (without "javascript:") and it will run.






                    share|improve this answer


























                    • I'm on desktop Linux, but this worked for me: javascript:var a=function(){ alert(prompt()); }(). (Edit - added 'alert' around 'prompt' to show use of the output.)

                      – John P
                      Aug 14 '17 at 18:57


















                    4














                    For firefox android version, you can try this bookmarklet:



                    javascript:var a=prompt();var f=Function(a);f();



                    It will open a prompt box. Type your command in it (without "javascript:") and it will run.






                    share|improve this answer


























                    • I'm on desktop Linux, but this worked for me: javascript:var a=function(){ alert(prompt()); }(). (Edit - added 'alert' around 'prompt' to show use of the output.)

                      – John P
                      Aug 14 '17 at 18:57
















                    4












                    4








                    4







                    For firefox android version, you can try this bookmarklet:



                    javascript:var a=prompt();var f=Function(a);f();



                    It will open a prompt box. Type your command in it (without "javascript:") and it will run.






                    share|improve this answer















                    For firefox android version, you can try this bookmarklet:



                    javascript:var a=prompt();var f=Function(a);f();



                    It will open a prompt box. Type your command in it (without "javascript:") and it will run.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Dec 23 '17 at 4:53









                    GramThanos

                    1034




                    1034










                    answered Jan 24 '14 at 18:51









                    ranjan_purbeyranjan_purbey

                    413




                    413













                    • I'm on desktop Linux, but this worked for me: javascript:var a=function(){ alert(prompt()); }(). (Edit - added 'alert' around 'prompt' to show use of the output.)

                      – John P
                      Aug 14 '17 at 18:57





















                    • I'm on desktop Linux, but this worked for me: javascript:var a=function(){ alert(prompt()); }(). (Edit - added 'alert' around 'prompt' to show use of the output.)

                      – John P
                      Aug 14 '17 at 18:57



















                    I'm on desktop Linux, but this worked for me: javascript:var a=function(){ alert(prompt()); }(). (Edit - added 'alert' around 'prompt' to show use of the output.)

                    – John P
                    Aug 14 '17 at 18:57







                    I'm on desktop Linux, but this worked for me: javascript:var a=function(){ alert(prompt()); }(). (Edit - added 'alert' around 'prompt' to show use of the output.)

                    – John P
                    Aug 14 '17 at 18:57




















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Ask Ubuntu!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f376839%2fhow-to-run-javascript-in-mozilla-url-bar%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                    Mangá

                    Eduardo VII do Reino Unido