投稿時間:2022-03-27 06:18:40 RSSフィード2022-03-27 06:00 分まとめ(19件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
TECH Engadget Japanese 1998年3月27日、歩いてためたワットで仲良くなる「ポケットピカチュウ」が発売されました:今日は何の日? https://japanese.engadget.com/today27-203023258.html 発売 2022-03-26 20:30:23
Linux Ubuntuタグが付けられた新着投稿 - Qiita いつのまにかUbuntuにGoogleChromeをインストールするのが簡単になっていた話 https://qiita.com/sakots/items/34901763ffa746a3fc32 chrome 2022-03-27 05:45:51
海外TECH MakeUseOf 7 Common Product Photography Mistakes (And How to Avoid Them) https://www.makeuseof.com/product-photography-mistakes-how-to-avoid/ common 2022-03-26 20:30:13
海外TECH DEV Community Single Page Application Routing Using Hash or URL https://dev.to/thedevdrawer/single-page-application-routing-using-hash-or-url-9jh Single Page Application Routing Using Hash or URLOne of the most asked code questions during a front end interview is Can you create a single page application with routes without a framework In this tutorial I show you how to create a custom routing system for your single page application using either the hash or URL method without a framework This tutorial shows you how to build a Single Page App using vanilla JavaScript I show you how to implement client side routing both ways hash or URL in an easy to use format that can be replicated for any project View This On YouTube Folder StructureWe are using a basic HTML structure You can set up your files however you like but for the sake of this tutorial you can replicate what I have below index html templates html index html about html contact html js router js Let s Create Our HTMLWe are going to create a basic HTML document to serve as the main page On this page we are going to have a nav section and a content section You can build this out however you want but note the lt nav gt lt nav gt tags are used for URL routing so your nav needs to be present within those tags if you are going the URL method lt DOCTYPE html gt lt html lang en gt lt head gt lt meta charset UTF gt lt meta http equiv X UA Compatible content IE edge gt lt meta name viewport content width device width initial scale gt lt title gt lt title gt lt head gt lt body gt lt nav gt lt nav gt lt div id content gt lt div gt lt body gt lt html gt Creating the JS FileBefore the lt body gt closing tag you need to add this reference to the JS file you created above lt script src js router js gt lt script gt Option One URL RoutingFirst we are going to go over how to do this with URL routing This means that your links will look like about This is the typical look of a URL the hash method uses to break up the pages I will go over that further down Use Case WebsitesThis option is better for SEO and is more user friendly NOTE There are some downsides to using this method You need to configure the webserver to serve the index html for SPA Route Paths You can do this at the server level but if you are using something like VS Code LIVE SERVER you cannot This means if you navigate directly to about the server will not render the file as it needs to load the index html scripts first You can modify your htaccess file to accomplish this Add the HTML navigationAdd the following between the lt nav gt lt nav gt tags in your index html file lt a href gt Home lt a gt lt a href about gt About lt a gt lt a href contact gt Contact lt a gt Add the navigation links in HTMLNow let s get started on the JS First we want to make any link in the lt nav gt lt nav gt tags use our routing create document click that watches the nav links onlydocument addEventListener click e gt const target e if target matches nav a return e preventDefault route Create the RoutesEach route will have an object array associated with it This will tell the script what the URL reference is as well as what template title and description are to be used const routes template templates html title description Page not found template templates index html title Home description This is the home page about template templates about html title About Us description This is the about page contact template templates contact html title Contact Us description This is the contact page Create a function that watches the URL and calls the urlLocationHandlerconst route event gt event event window event get window event if event argument not provided event preventDefault window history pushState state unused target link window history pushState event target href locationHandler Create a function that handles the URL locationconst locationHandler async gt const location window location pathname get the url path if the path length is set it to primary page route if location length location get the route object from the urlRoutes object const route routes location routes get the html from the template const html await fetch route template then response gt response text set the content of the content div to the html document getElementById content innerHTML html set the title of the document to the title of the route document title route title set the description of the document to the description of the route document querySelector meta name description setAttribute content route description Finishing The ScriptLastly we need to call the function when the page is first loaded or else the home page will not work unless it is clicked on We also need to add a watcher for the URL changes so the script knows when to show new content add an event listener to the window that watches for url changeswindow onpopstate locationHandler call the urlLocationHandler function to handle the initial urlwindow route route call the urlLocationHandler function to handle the initial urllocationHandler Option Two Hash RoutingPlease replace the content of your router js file with the following code if you are using the hash method Now on to the second option Hash routing is more common if you are using a framework but if you are creating it from scratch the negative SEO benefit may make you shy away This means that your links will look like about instead of the typical URL method above For some this URL type may not be optimal due to it being so different than what your users are used to Otherwise the code is very similar to the URL method even shorter Use Case Apps Landing PagesNOTE There are some downsides to using this method sing hashes may not be the best route for SEO and it may also be unusual for some users which may make them not use the website Add the HTML navigationAdd the following between the lt nav gt lt nav gt tags in your index html file lt a href gt Home lt a gt lt a href about gt About lt a gt lt a href contact gt Contact lt a gt Create the RoutesThe hash routes look very similar to the URL routes above You can reuse this part of the script The difference is mainly how the route link key is defined const routes template templates html title description Page not found template templates index html title Home description This is the home page about template templates about html title About Us description This is the about page contact template templates contact html title Contact Us description This is the contact page Create a function that handles the URL locationconst locationHandler async gt get the url path replace hash with empty string var location window location hash replace if the path length is set it to primary page route if location length location get the route object from the routes object const route routes location routes get the html from the template const html await fetch route template then response gt response text set the content of the content div to the html document getElementById content innerHTML html set the title of the document to the title of the route document title route title set the description of the document to the description of the route document querySelector meta name description setAttribute content route description Finishing The ScriptAgain we need to call the function when the page is first loaded or else the home page will not work unless it is clicked on We also need to add a watcher for the hash changes so the script knows when to show new content create a function that watches the hash and calls the urlLocationHandlerwindow addEventListener hashchange locationHandler call the urlLocationHandler to load the pagelocationHandler ConclusionSo while there are many ways to do this these are the you need to know to make you a better frontend developer Once you know these you can move on to React or Vue frameworks So hopefully these simple yet crucial learning methods helped you pass that dreaded interview question at the beginning of the article good luck 2022-03-26 20:06:59
海外TECH Engadget FCC says Russia’s Kaspersky Lab is a national security threat https://www.engadget.com/fcc-labels-russia-kaspersky-lab-national-security-threat-203609448.html?src=rss FCC says Russia s Kaspersky Lab is a national security threatOn Friday the Federal Communications Commission added Russia s Kaspersky Lab to its “Covered List labeling the cybersecurity firm an “unacceptable national security risk to the US The move marks the first time the agency has blacklisted a Russian company nbsp With the decision US companies can t use subsidies from the FCC s billion Universal Service Fund for supporting telecom deployments in rural and underserved communities to purchase products and services from Kaspersky All seven other organizations on the list hail from China with among the most notable being Huawei and ZTE FCC Commissioner Brendan Car said the designation would help the US secure its networks from “threats posed by Chinese and Russian state backed entities seeking to engage in espionage and otherwise harm America s interests quot The two other companies the FCC added to the list on Friday were China Telecom and China Mobile both of which were already subject to previous restrictions “This decision is not based on any technical assessment of Kaspersky products that the company continuously advocates for but instead is being made on political grounds Kaspersky said following the announcement The company noted it was ready to work with the FCC and other US government agencies to address any regulatory concerns The move is partly symbolic Before Friday s announcement a order by former President Donald Trump had already banned the federal government from using Kaspersky software The FCC did not cite Russia s recent invasion of Ukraine for this most recent move 2022-03-26 20:36:09
海外科学 NYT > Science ‘OK Doomer’ and the Climate Advocates Who Say It’s Not Too Late https://www.nytimes.com/2022/03/22/climate/climate-change-ok-doomer.html OK Doomer and the Climate Advocates Who Say It s Not Too LateA growing chorus of young people is focusing on climate solutions “ It s too late means I don t have to do anything and the responsibility is off me 2022-03-26 20:58:54
ニュース BBC News - Home P&O Ferries: Protests at ports against sackings https://www.bbc.co.uk/news/uk-60887808?at_medium=RSS&at_campaign=KARANGA crews 2022-03-26 20:18:44
ビジネス ダイヤモンド・オンライン - 新着記事 巣鴨・桜蔭・広尾学園…首都圏中高一貫校で理系に強いのは?理系大学「高進学率校」リスト - わが子に最強の中高一貫校&小学校&塾 https://diamond.jp/articles/-/298830 中高一貫校 2022-03-27 05:25:00
ビジネス ダイヤモンド・オンライン - 新着記事 全国「認知症疾患医療センター」大調査!診断設備、入院対応、注力分野…全22項目【九州・沖縄編】 - 決定版 後悔しない「認知症」 https://diamond.jp/articles/-/298648 医療機関 2022-03-27 05:20:00
ビジネス ダイヤモンド・オンライン - 新着記事 【池上彰氏が5分で解説(4)】ウクライナ危機はあと半年続く、日本がすべき「覚悟」とは? - 混迷ウクライナ https://diamond.jp/articles/-/300083 解説 2022-03-27 05:15:00
ビジネス ダイヤモンド・オンライン - 新着記事 広島・岡山・福岡の中学受験、22年は難化!地方の激戦区と名門校の最新事情 - わが子に最強の中高一貫校&小学校&塾 https://diamond.jp/articles/-/298829 中学受験 2022-03-27 05:10:00
ビジネス ダイヤモンド・オンライン - 新着記事 「働けど働けどなお我が暮らし…」石川啄木の短歌が現代日本人の福音になる理由 - ビジネスを強くする教養 https://diamond.jp/articles/-/300022 「働けど働けどなお我が暮らし…」石川啄木の短歌が現代日本人の福音になる理由ビジネスを強くする教養年は歌人・石川啄木の没後年に当たる。 2022-03-27 05:05:00
北海道 北海道新聞 イラン「米が過剰要求」 核協議で批判 https://www.hokkaido-np.co.jp/article/661669/ 過剰 2022-03-27 05:32:00
北海道 北海道新聞 堀江さん太平洋横断へ出航 83歳、挑戦に「わくわく」 https://www.hokkaido-np.co.jp/article/661668/ 横断 2022-03-27 05:32:00
北海道 北海道新聞 <社説>対ロ圧力強化 撤退要求を受け止めよ https://www.hokkaido-np.co.jp/article/661649/ 首脳 2022-03-27 05:05:00
ビジネス 東洋経済オンライン 「健康食以外口にしない人」に疑われる障害の正体 「健康志向」と「オルトレキシア」の決定的違い | 健康 | 東洋経済オンライン https://toyokeizai.net/articles/-/541181?utm_source=rss&utm_medium=http&utm_campaign=link_back 健康志向 2022-03-27 05:40:00
ビジネス 東洋経済オンライン ニュースでは伝わらない「ウクライナ人の叫び」 記者軍団が現地の人のリアルを世界に発信 | ウクライナ侵攻、危機の本質 | 東洋経済オンライン https://toyokeizai.net/articles/-/541712?utm_source=rss&utm_medium=http&utm_campaign=link_back 普通の人々 2022-03-27 05:20:00
ビジネス 東洋経済オンライン 責任者が明かす「大学ファンド」運用戦略の全貌 目標に掲げる運用益4.38%は野心的と思わない | 先端科学・研究開発 | 東洋経済オンライン https://toyokeizai.net/articles/-/541620?utm_source=rss&utm_medium=http&utm_campaign=link_back 東洋経済オンライン 2022-03-27 05:10:00
海外TECH reddit Ohtani, first pitch crushing for his first home run of Spring Training https://www.reddit.com/r/baseball/comments/tp39nq/ohtani_first_pitch_crushing_for_his_first_home/ Ohtani first pitch crushing for his first home run of Spring Training submitted by u KamartyMcFlyweight to r baseball link comments 2022-03-26 20:22:19

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)