Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.

Thread Tools Display Modes
Share |
Old 02-17-2015, 10:16 AM
NickCUK NickCUK is offline
Junior Member
Join Date: 05-22-11
Posts: 25
iTrader: 0 / 0%
Simplest javascript polyfill to emulate HTML5 <details> tag in all browsers

I would like to have expanding paragraphs aka the HTML5 tag. However most browsers do not support this yet so we would need a javascript fallback of some sort. Question is how best to do this.

It seems there are JQuery solutions to this but my initial thoughts are that this is a large overhead to solve a small problem. However in reality it may be that most browsers would already have the jquery library cached in which case it is no overhead at all. I guess that would only work if we linked to an external jquery CDN, not a locally served one.

Alternatively there are smaller javascript solutions but they would not already be cached by the local browser.

And what about Modernizr is that common enough that it would likely already be cached?
Reply With Quote



Old 02-19-2015, 10:55 AM
raicabogdan's Avatar
raicabogdan raicabogdan is offline
Contributing Member
Join Date: 10-03-08
Location: On the web
Posts: 116
iTrader: 0 / 0%
When you say *cached*, are you perhaps thinking you're actually having access to js libraries/files from other sites? Because that's not possible.

The cache works per domain, so if you provide a specific js file and it is cached by the browser, only your site will be able to read that cached file. The overhead is also small, almost negligible for jquery at least.

As for your questions, Modernizr and jquery are two options that you can very well do what you need, depends really on what you're trying to do. Personally I would simply use jquery and just change CSS values based on specific events to replicate the html5 effect.

You can probably do it from javascript directly and do only the specific part you require (have done that before, instead of using libraries with lots of options, and I was only using 1 or two from it)
Reply With Quote
Go Back   Webmaster Forum > Web Development > Coding Forum


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fallback for When No Javascript - HTML5 HTMLBasicTutor Coding Forum 1 06-20-2013 06:26 PM
Javascript Vs Html5/css3? Bishvabis Coding Forum 9 06-18-2013 12:11 AM
Is HTML5 a New Battleground for Browsers? snakeair Tech Talk 2 01-02-2012 06:48 PM
The simplest existent cms solution? kos Coding Forum 6 02-06-2011 11:00 AM
IE9 Outperforms Other Browsers for HTML5 Compliance snakeair Web Usability 2 11-05-2010 08:54 AM

V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory

All times are GMT -7. The time now is 05:46 AM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC