• Login
    • Search
    • Categories
    • Recent
    • Tags
    • Users
    • Groups
    • Rules
    • Help

    Do more on the web, with a fast and secure browser!

    Download Opera browser with:

    • built-in ad blocker
    • battery saver
    • free VPN
    Download Opera

    How do I view the source code of a web page?

    Opera for Android
    2
    12
    21718
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • custdemotest
      custdemotest last edited by

      javascript:var n=document.firstChild;while(n && n.nodeType!=Node.ELEMENT_NODE) n=n.nextSibling;document.write('

      ' + n.outerHTML.replace(/&/g, '&amp;').replace(/</g, '<font color=\'#aa6600\'>&lt;').replace(/>/g, '&gt;</font>'));
      Reply Quote 0
        1 Reply Last reply
      • custdemotest
        custdemotest last edited by

        javascript:var n=document.firstChild;while(n && n.nodeType!=Node.ELEMENT_NODE) n=n.nextSibling;document.write('

        ' + n.outerHTML.replace(/&/g, '&amp;').replace(/</g, '<font color=\'#aa6600\'>&lt;').replace(/>/g, '&gt;</font>'));
        
        It's  . < PRE >.  between lines, check edit mode.
        Reply Quote 0
          1 Reply Last reply
        • custdemotest
          custdemotest last edited by

          server:source works only with opera mini.

          Reply Quote 0
            1 Reply Last reply
          • custdemotest
            custdemotest last edited by

            javascript:var n=document.firstChild;while(n && n.nodeType!=Node.ELEMENT_NODE) n=n.nextSibling;document.write('

            ' + n.outerHTML.replace(/&amp;/g, '&amp;').replace(/&lt;/g, '&lt;').replace(/&gt;/g, '&gt;'));
            >   
            >
            
            ∆
            Reply Quote 0
              1 Reply Last reply
            • custdemotest
              custdemotest last edited by

              Rr

              Reply Quote 0
                1 Reply Last reply
              • custdemotest
                custdemotest last edited by

                Doesn't work. < p r e > (without space) is blank in this forum, that must be in right after write('

                Reply Quote 0
                  1 Reply Last reply
                • custdemotest
                  custdemotest last edited by

                  http://naxtuz.heck.in/files/javascript.txt even better.

                  Reply Quote 0
                    1 Reply Last reply
                  • alexisadvance
                    alexisadvance last edited by

                    I do not understand your comments. What is that JS file for? I just need to view a website source code in opera for Android.

                    Reply Quote 0
                      1 Reply Last reply
                    • alexisadvance
                      alexisadvance last edited by

                      OK, now I understood your comment. This JS code is for use in the address bar. Thanks!

                      But, why is it no longer possible to see the source from the "view-source:" prefix? Having to run a JS code is not a good choice.

                      Hopefully some Opera developer answered me...

                      Reply Quote 0
                        1 Reply Last reply
                      • custdemotest
                        custdemotest last edited by

                        view-source: is a blank page in Opera 28 or latest Chrome 51.

                        Reply Quote 1
                          1 Reply Last reply
                        • First post
                          Last post

                        Computer browsers

                        • Opera for Windows
                        • Opera for Mac
                        • Opera for Linux
                        • Opera beta version
                        • Opera USB

                        Mobile browsers

                        • Opera for Android
                        • Opera Mini
                        • Opera Touch
                        • Opera for basic phones

                        • Add-ons
                        • Opera account
                        • Wallpapers
                        • Opera Ads

                        • Help & support
                        • Opera blogs
                        • Opera forums
                        • Dev.Opera

                        • Security
                        • Privacy
                        • Cookies Policy
                        • EULA
                        • Terms of Service

                        • About Opera
                        • Press info
                        • Jobs
                        • Investors
                        • Become a partner
                        • Contact us

                        Follow Opera

                        • Opera - Facebook
                        • Opera - Twitter
                        • Opera - YouTube
                        • Opera - LinkedIn
                        • Opera - Instagram

                        © Opera Software 1995-2025