{"id":74,"date":"2010-02-10T12:57:27","date_gmt":"2010-02-10T16:57:27","guid":{"rendered":"http:\/\/www.joebillman.com\/blog\/?p=74"},"modified":"2010-02-10T12:57:27","modified_gmt":"2010-02-10T16:57:27","slug":"the-proper-way-of-referencing-elements-on-a-web-page","status":"publish","type":"post","link":"https:\/\/www.joebillman.com\/blog\/?p=74","title":{"rendered":"The Proper Way of Referencing Elements on a Web Page"},"content":{"rendered":"<p>I was recently working on a web page that was not displaying some Flash elements properly on some people&#8217;s browsers or so I thought. After beating my head for a bit I realized what the problem was. The .swf file that I was referencing had an absolute path that included the &#8220;www.&#8221; in the URL. Here is an example: &#8220;&lt;param name=&#8221;movie&#8221; value=&#8221;http:\/\/www.mywebsite.com\/swfs\/my_movie.swf&#8221; \/&gt;. The problem was when someone went to the site and did not include the &#8220;www&#8221; for example: &#8220;http:\/\/mywebsite.com&#8221;. The solution to this is rather simple and should be the practice you use when referencing elements on your pages. It&#8217;s called root referencing and here is an example: &#8220;&lt;param name=&#8221;movie&#8221; value=&#8221;\/swfs\/my_movie.swf&#8221; \/&gt;. You leave off the &#8220;http:\/\/&#8221;,\u00a0the &#8220;www&#8221; and the site name and instead just put a &#8220;\/&#8221; at the beginning. This will work in all cases even if the page that is referencing the element is nested multiple folders deep.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was recently working on a web page that was not displaying some Flash elements properly on some people&#8217;s browsers or so I thought. After beating my head for a bit I realized what the problem was. The .swf file that I was referencing had an absolute path that included the &#8220;www.&#8221; in the URL. &hellip; <a href=\"https:\/\/www.joebillman.com\/blog\/?p=74\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;The Proper Way of Referencing Elements on a Web Page&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-74","post","type-post","status-publish","format-standard","hentry","category-web-design"],"_links":{"self":[{"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/74","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=74"}],"version-history":[{"count":0,"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/74\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=74"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=74"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joebillman.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}