René's URL Explorer Experiment


Title: 【JavaScript】【学习心得】学习 JavaScript 第四天 · Issue #7 · paddingme/Learning-JavaScript · GitHub

Open Graph Title: 【JavaScript】【学习心得】学习 JavaScript 第四天 · Issue #7 · paddingme/Learning-JavaScript

X Title: 【JavaScript】【学习心得】学习 JavaScript 第四天 · Issue #7 · paddingme/Learning-JavaScript

Description: 经过了三天的持续学习,咱们的第一个 js 网页你有没有做出来呢?这个简单的 JavaScript 图片库 它是否完美?今天我们来学习一些最佳实践,来完善我们的这个 JavaScript 图片库。 质疑一切 若要使用 JavaScript 就要确认:这么做会对用户的浏览体验产生怎样的影响?还有个更重要的问题:如果用户的浏览器不支持 JavaScript 该怎么办?这些都是我们需要考虑的。 平稳退化(graceful degradation) 禁止使用弹窗,这是一个体验非常...

Open Graph Description: 经过了三天的持续学习,咱们的第一个 js 网页你有没有做出来呢?这个简单的 JavaScript 图片库 它是否完美?今天我们来学习一些最佳实践,来完善我们的这个 JavaScript 图片库。 质疑一切 若要使用 JavaScript 就要确认:这么做会对用户的浏览体验产生怎样的影响?还有个更重要的问题:如果用户的浏览器不支持 JavaScript 该怎么办?这些都是我们需要考虑的。 平稳...

X Description: 经过了三天的持续学习,咱们的第一个 js 网页你有没有做出来呢?这个简单的 JavaScript 图片库 它是否完美?今天我们来学习一些最佳实践,来完善我们的这个 JavaScript 图片库。 质疑一切 若要使用 JavaScript 就要确认:这么做会对用户的浏览体验产生怎样的影响?还有个更重要的问题:如果用户的浏览器不支持 JavaScript 该怎么办?这些都是我们需要考虑的。 平稳...

Opengraph URL: https://github.com/paddingme/Learning-JavaScript/issues/7

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"【JavaScript】【学习心得】学习 JavaScript 第四天","articleBody":"经过了三天的持续学习,咱们的第一个 js 网页你有没有做出来呢?这个简单的 [JavaScript 图片库](http://codepen.io/paddingme/pen/qCuDo) 它是否完美?今天我们来学习一些最佳实践,来完善我们的这个 JavaScript 图片库。\n## 质疑一切\n\n若要使用 JavaScript 就要确认:这么做会对用户的浏览体验产生怎样的影响?还有个更重要的问题:如果用户的浏览器不支持 JavaScript 该怎么办?这些都是我们需要考虑的。\n## 平稳退化(graceful degradation)\n\n禁止使用弹窗,这是一个体验非常糟糕的应用,在读屏软件上不一定能弹出(可访问性),可以用其他手段实现同样的效果,例如说朦态窗。\n## `window.open(url,name,features)`\n- url 一个可选的字符串,声明了要在新窗口中显示的文档的 url 。如果省略了这个参数,或者它的值是空字符串,那么新窗口就不会显示任何文档。\n- name 一个可选的字符串,该字符串是一个由逗号分隔的特征列表,其中包括数字、字母和下划线,该字符声明了新窗口的名称。这个名称可以用作标记 \u003ca\u003e 和 \u003cform\u003e 的属性 target 的值。如果该参数指定了一个已经存在的窗口,那么 open() 方法就不再创建一个新窗口,而只是返回对指定窗口的引用。在这种情况下,features 将被忽略。\n- features 一个可选的字符串,声明了新窗口要显示的标准浏览器的特征。如果省略该参数,新窗口将具有所有标准特征。在窗口特征这个表格中,我们对该字符串的格式进行了详细的说明。\n\n``` javascript\nfunction popUp(winURL){\n    window.open(winURL,\"popup\",\"width=320,height=480\");\n}\n```\n## JavaScript 伪协议\n\n``` html\n\u003ca href=\"JavaScript:popUp('http://padding.me')\"\u003eExample\u003c/a\u003e\n```\n\n这条语句在支持 \"JavaScript:\" 伪协议的浏览器中正常运行,较老的浏览器则会去尝试打开那个链接但失败,支持这种伪协议但禁用了 JavaScript 功能的浏览器则会什么也不做。  \n\"JavaScript:\" 伪协议调用 JavaScript 代码的做法非常不好。\n## 内嵌的事件处理函数\n\n``` html\n\u003ca href=\"#\" onclick=\"popUp('http://padding.me');return false;\"\u003eExample\u003c/a\u003e\n```\n\n这样的做法同样操作,不能进行平稳退化。若用户禁用 JavaScript 功能,这样的链接毫无作用。\n\n做到平稳退化,应该将\"#\"换为真实的 url。\n\n``` html\n\u003ca href=\"http://paddingme\" onclick=\"popUp('http://padding.me');return false;\"\u003eExample\u003c/a\u003e\n```\n\n``` html\n\u003ca href=\"http://paddingme\" onclick=\"popUp(this.getAttribute('href'));return false;\"\u003eExample\u003c/a\u003e\n```\n\n``` html\n\u003ca href=\"http://paddingme\" onclick=\"popUp(this.href);return false;\"\u003eExample\u003c/a\u003e\n```\n## 渐进增强\n\nCSS的出现,有了 HTML 结构与样式的分离。这也是一种渐进增强,如果禁用了 CSS,网页还是能展现基本的文档内容。\n## 分离  JavaScript\n\n``` html\n\u003ca href=\"http://paddingme\" class=\"popUp\"\u003eExample\u003c/a\u003e\n```\n\n``` javascript\nwindow.onload = prepareLinks;\nfunction prepareLinks(){\n    if(!document.getElementsByTagName) return false;\n    var links = document.getElementsByTagName(\"a\");\n    for(var i = 0;i \u003c links.length;i++){\n        if(links[i].getAttribute(\"class\") == \"popUp\"){\n            links[i].onclick = function() {\n                popUp(this.getAttribute(\"href\"));\n                return false;\n            }\n        }\n    }\n}\n```\n## 性能考虑\n### 尽量少访问 DOM 和尽量减少标记\n\n不管是什么时候,只要是查询 DOM 中的某些元素,浏览器都会搜索整个 DOM 树,从中查找可能匹配的元素。\n\n而过多不必要的元素标记只会增加 DOM 树的规模,进而增加遍历 DOM 树以查找特定元素的时间。\n### 合并和放置脚本\n\n将多个脚本合并为一个脚本,以减少浏览器向服务器端发送求,将脚本放在 `\u003c/body\u003e`之前,为什么呢?这样 DOM 操作可以在浏览器将网页全部加载渲染完毕之后开始进行,以减少浏览器对网页的重绘,提升网页加载速度和性能。\n### 压缩脚本\n\n将脚本压缩减小脚本体积,减缓带宽压力,更快的将脚本下载下来。\n\nOK,今天学了这些最佳实践,明天我们根据这些最佳实践来重构我们的 JavaScript 图片库。\n","author":{"url":"https://github.com/paddingme","@type":"Person","name":"paddingme"},"datePublished":"2014-11-20T15:21:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/7/Learning-JavaScript/issues/7"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:df162be3-e535-a28f-6f04-0e43720738b3
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAB40:F0ECB:271BCB2:3920F08:6A60D61A
html-safe-nonce4f54b795f2c2ed22cbbde94cb24c16b9be393b9c4cbcda0dac9b0a68c02b5979
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQjQwOkYwRUNCOjI3MUJDQjI6MzkyMEYwODo2QTYwRDYxQSIsInZpc2l0b3JfaWQiOiIxMDcxMzYzMjQ3MTI2NDAyNTg2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac3a3af8ec7814f41252e311e2aa3650a11ef99c832eaa829c58c261fe70ecde95
hovercard-subject-tagissue:49565721
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/paddingme/Learning-JavaScript/7/issue_layout
twitter:imagehttps://opengraph.githubassets.com/da584aaa04bb61130c827dbc4f532769516b505f81bef95c01612cd4701eb536/paddingme/Learning-JavaScript/issues/7
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/da584aaa04bb61130c827dbc4f532769516b505f81bef95c01612cd4701eb536/paddingme/Learning-JavaScript/issues/7
og:image:alt经过了三天的持续学习,咱们的第一个 js 网页你有没有做出来呢?这个简单的 JavaScript 图片库 它是否完美?今天我们来学习一些最佳实践,来完善我们的这个 JavaScript 图片库。 质疑一切 若要使用 JavaScript 就要确认:这么做会对用户的浏览体验产生怎样的影响?还有个更重要的问题:如果用户的浏览器不支持 JavaScript 该怎么办?这些都是我们需要考虑的。 平稳...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamepaddingme
hostnamegithub.com
expected-hostnamegithub.com
None025e511fb0e6dd11aaa36892212f7bcc13708244bc2bcbeff1cf34fc77723812
turbo-cache-controlno-preview
go-importgithub.com/paddingme/Learning-JavaScript git https://github.com/paddingme/Learning-JavaScript.git
octolytics-dimension-user_id5771087
octolytics-dimension-user_loginpaddingme
octolytics-dimension-repository_id25473884
octolytics-dimension-repository_nwopaddingme/Learning-JavaScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id25473884
octolytics-dimension-repository_network_root_nwopaddingme/Learning-JavaScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release405b1f59618e9c5e102e2408c26ce58f1937fbca
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/paddingme/Learning-JavaScript/issues/7#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpaddingme%2FLearning-JavaScript%2Fissues%2F7
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpaddingme%2FLearning-JavaScript%2Fissues%2F7
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=paddingme%2FLearning-JavaScript
Reloadhttps://github.com/paddingme/Learning-JavaScript/issues/7
Reloadhttps://github.com/paddingme/Learning-JavaScript/issues/7
Reloadhttps://github.com/paddingme/Learning-JavaScript/issues/7
paddingme https://github.com/paddingme
Learning-JavaScripthttps://github.com/paddingme/Learning-JavaScript
Notifications https://github.com/login?return_to=%2Fpaddingme%2FLearning-JavaScript
Fork 13 https://github.com/login?return_to=%2Fpaddingme%2FLearning-JavaScript
Star 28 https://github.com/login?return_to=%2Fpaddingme%2FLearning-JavaScript
Code https://github.com/paddingme/Learning-JavaScript
Issues 30 https://github.com/paddingme/Learning-JavaScript/issues
Pull requests 0 https://github.com/paddingme/Learning-JavaScript/pulls
Actions https://github.com/paddingme/Learning-JavaScript/actions
Projects https://github.com/paddingme/Learning-JavaScript/projects
Wiki https://github.com/paddingme/Learning-JavaScript/wiki
Security and quality 0 https://github.com/paddingme/Learning-JavaScript/security
Insights https://github.com/paddingme/Learning-JavaScript/pulse
Code https://github.com/paddingme/Learning-JavaScript
Issues https://github.com/paddingme/Learning-JavaScript/issues
Pull requests https://github.com/paddingme/Learning-JavaScript/pulls
Actions https://github.com/paddingme/Learning-JavaScript/actions
Projects https://github.com/paddingme/Learning-JavaScript/projects
Wiki https://github.com/paddingme/Learning-JavaScript/wiki
Security and quality https://github.com/paddingme/Learning-JavaScript/security
Insights https://github.com/paddingme/Learning-JavaScript/pulse
【JavaScript】【学习心得】学习 JavaScript 第四天https://github.com/paddingme/Learning-JavaScript/issues/7#top
Mu-Help-Planhttps://github.com/paddingme/Learning-JavaScript/issues?q=state%3Aopen%20label%3A%22Mu-Help-Plan%22
https://github.com/paddingme
paddingmehttps://github.com/paddingme
on Nov 20, 2014https://github.com/paddingme/Learning-JavaScript/issues/7#issue-49565721
JavaScript 图片库http://codepen.io/paddingme/pen/qCuDo
Mu-Help-Planhttps://github.com/paddingme/Learning-JavaScript/issues?q=state%3Aopen%20label%3A%22Mu-Help-Plan%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.