如何查看源代码

下载PDF文件下载PDF文件

源代码是所有网站背后的程序语言,这篇文章将介绍如何在大部分常用浏览器上查看网页的源代码。但是移动端的Safari浏览器除外,你无法在移动设备的Safari浏览器中查看网页的源代码。

方法 1
方法 1 的 2:

Chrome、火狐、Edge和IE浏览器

下载PDF文件
  1. How.com.vn 中文: Step 1 打开网络浏览器。
    你可以使用相同的方法,来在Chrome、火狐、Microsoft Edge和IE浏览器上查看网页的源代码。
  2. How.com.vn 中文: Step 2 打开一个网页。
    这个网页应该是你想要浏览其源代码的网页。
  3. How.com.vn 中文: Step 3 右键单击页面。
    如果你使用的是Mac电脑,且鼠标只有一个按钮,你可以按住Control键,然后点击页面。如果你使用的是触屏笔记本,可以用两个手指点击页面。接着会打开一个下拉菜单。
    • 请不要右键点击一个链接或一张照片,这样会打开错误的右键菜单。
  4. How.com.vn 中文: Step 4 点击查看页面源代码或查看源代码。
    接着会在新窗口中或在当前窗口的下方显示浏览页面的源代码。
    • 在Chrome和火狐浏览器中,你会看到查看页面源代码一项,而在Microsoft Edge和IE浏览器中,会出现查看源代码一项。
    • 你也可以按下Ctrl+U(Windows电脑)或option+Command+U键(Mac电脑)来查看页面的源代码。
    广告
方法 2
方法 2 的 2:

Safari浏览器

下载PDF文件
  1. How.com.vn 中文: Step 1 打开Safari浏览器。
    它是一个蓝色的罗盘状图标。
  2. How.com.vn 中文: Step 2 点击Safari。
    它位于Mac电脑菜单栏的左上角,点击后会打开一个下拉菜单。
  3. How.com.vn 中文: Step 3 点击偏好设置。
    这个选项位于下拉菜单的中部。
  4. How.com.vn 中文: Step 4 点击高级 选项卡。
    它位于偏好设置窗口的右上角。
  5. How.com.vn 中文: Step 5 勾选“在菜单栏中显示开发菜单”复选框。
    这个选项位于偏好设置窗口的底部。接着,你应该能看到菜单栏中出现一个开发菜单。
  6. How.com.vn 中文: Step 6 打开一个网页。
    这个网页应该是你想要浏览其源代码的网页。
  7. How.com.vn 中文: Step 7 点击 开发按钮。
    这个菜单位于Mac电脑的菜单栏中、窗口菜单的左侧。
  8. How.com.vn 中文: Step 8 点击显示页面源代码。
    它位于下拉菜单的底部。点击这个选项,会让Safari浏览器显示网页的源代码。
    • 你也可以按下option+Command+U组合键来查看网页的源代码。
    广告

小提示

  • 尽管你无法在移动设备上查看源代码,但是你可以在iPhone或iPad设备上将网页保存为Safari书签,然后查看网页的源代码。
广告

警告

  • 在下载那些声称能显示网页源代码的第三方应用程序时,要格外小心、谨慎。


广告

关于本How.com.vn

How.com.vn 中文: How.com.vn员工
共同创作者是 :
How.com.vn专职作家
这篇文章由我们训练有素的编辑和研究团队共同创作,他们对文章的准确性和全面性进行了验证。

How.com.vn的内容管理团队会严密监督编辑人员的工作,确保每篇文章都符合我们的高质量标准要求。 这篇文章已经被读过115,296次。
本页面已经被访问过115,296次。

这篇文章对你有帮助吗?

⚠️ Disclaimer:

Content from Wiki How 中文 language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

Notices:
  • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
  • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
  • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
  • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

广告