Category: HTML

Javascript Articles, Errors and Fixes

[Solved – 10 Answers] JAVASCRIPT -HTML – How to get current URL in JavaScript

PROBLEM: How to get the path of the current URL and assign it to a variable? Example URL: http://localhost/menuname.de?foo=bar&number=0 SOLUTION 1: To get the path, we can use: SOLUTION 2: In jQuery style: The location object also has other properties, like host, hash, protocol, and pathname. SOLUTION 3: Property Result host www.wikitechy.com:8082 hostname www.wikitechy.com port […]

Javascript Articles, Errors and Fixes

[Solved – 9 Answers] JAVASCRIPT – HTML – How to Modify the URL without reloading the page

PROBLEM: How to Modify the URL without reloading the page? SOLUTION 1: Updating address bar with new URL without hash or reloading the page Example: we can then use window.onpopstate to detect the back/forward button navigation: This works in Chrome, Safari, FF4+, and IE10pp4+! SOLUTION 2: we can do this: use history.pushState like this: SOLUTION […]

CSS Articles, Errors and Fixes

[Solved -10 Answers] CSS – How to wrap text in a pre tag

PROBLEM: pre tags are super-useful for code blocks in HTML and for debugging output while writing scripts, but how to make the text word-wrap instead of printing out one long line? SOLUTION 1: CSS: SOLUTION 2: This works great to wrap text and maintain white-space within the pre-tag: SOLUTION 3: Skipping the pre tag and […]

CSS Articles, Errors and Fixes

[Solved -7 Answers] CSS – Targeting only Firefox with CSS

PROBLEM: Using conditional comments it is easy to target Internet Explorer with browser-specific CSS rules: Sometimes it is the Gecko engine (Firefox) that misbehaves. What would be best way to target only Firefox with your CSS rules and not a single other browser? That is, not only should Internet Explorer ignore the Firefox-only rules, but […]