What is the difference between source code and DOM?(源代码和 DOM 有什么区别?)
问题描述
- 在我的应用中,我想处理 Google 翻译定义,例如歌曲"一词的定义
- 当我检查返回的 http 消息时,它不包含短诗"表达.
- 但在 Safari 的 DOM 树视图中,我可以看到短诗"信息.
- 这是因为在加载页面后,一些 JavaScript 代码做了一些魔法?你如何在 iOS 应用中获得
DOM 树?UIWebView可以做到这么神奇?
- This is because after loading page some JavaScript code do some
magic? How would you get
DOM treein an iOS app?UIWebViewcan do such a magic?
推荐答案
页面的源代码和页面的 DOM 的概念相似,但又不同.源是未经任何客户端脚本掺杂的原始 HTML.它是 HTTP 请求对服务器的直接响应.另一方面,DOM 是相同的 HTML 结构,已被 JavaScript 修改.
The notions between a page's source and a page's DOM are similar, but different. The source is the raw HTML that is unadulterated by any client-side scripts. It is the direct response of the HTTP request to the server. The DOM, on the other hand, is the same HTML structure that has been modified by JavaScript.
源代码读取页面的 HTML 就像您在文本编辑器中打开它一样.源代码会在加载任何 JavaScript 之前反映您的 HTML 结构.虽然无法编辑内容,但查看浏览器从服务器接收的 HTML 很有用.
Source Code reads the page's HTML as if you opened it in a text editor. The source code reflects your HTML structure before any JavaScript is loaded. While the contents can’t be edited, it’s useful to see the HTML the browser receives from the server.
https://developer.apple.com/library/mac/documentation/AppleApplications/Conceptual/Safari_Developer_Guide/ResourcesandtheDOM/ResourcesandtheDOM.html
尝试阅读有关 API,我认为有用于翻译和东西的 API
Try to read about API, I think there are API's for translate and stuff
这篇关于源代码和 DOM 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:源代码和 DOM 有什么区别?
基础教程推荐
- Android:getLastKnownLocation(LocationManager.NETWORK_PROVIDER 2022-01-01
- AdMob 广告未在模拟器中显示 2022-01-01
- 通过重定向链接在 Google Play 中打开应用 2022-01-01
- Cocos2d iPhone 非矩形精灵触摸检测 2022-01-01
- libGDX 从精灵或纹理中获取像素颜色 2022-01-01
- 如何从 logcat 中删除旧数据? 2022-01-01
- NSString intValue 不能用于检索电话号码 2022-01-01
- iPhone - 获取给定地点/时区的当前日期和时间并将其与同一地点的另一个日期/时间进行比较的正确方法 2022-01-01
- iOS4 创建后台定时器 2022-01-01
- navigator.geolocation.getCurrentPosition 在 Android 浏览器上 2022-01-01
