When providing a JavaScript plug-in of services, such as Google Analytics, Alexa, JavaScript plug-ins, add-ons of social networks, social bookmarks like Facebook, MySpace, Twitter and the closest JavaScript service is Free Quote on [email protected] ... obviously web application developers built their scripts as well as they need a change/upgrade without requiring user's responses.
But if you do not understand how to build JavaScript applications to provide users like their processes, then read this free HTML JavaScript tutorial now. It shows you the full instructions and notes to build the best JavaScript plug-ins or add-ons for your own services.
- Demo
- Enlarge
- Reload
- New window
Free iPage Web Hosting for First Year NOW
If you're still looking for a reliable web host provider with affordable rates, why you don't take a little of time to try iPage, only with $1.89/month, included $500+ Free Extra Credits for the payment of 24 months ($45)?
Over 1,000,000+ existisng customers can not be wrong, definitely you're not, too! More important, when you register the web hosting at iPage through our link, we're going to be happy for resending a full refund to you. That's awesome! You should try iPage web hosting for FREE now! And contact us for anything you need to know about iPage.
If you've ever released a JavaScript widget, one which people can include within their site or even if you're one of those people that has had to copy one of those ugly chunks of code and somehow come to terms with placing it in your previously clean HTML, I'm sure you'll appreciate a cleaner and less scarring alternative. After all, anything's got to be better than this:
<div id="widget_133332_g_foobar"></div> <script> widget_133332_v_height = '233px'; widget_133332_v_width = '200px'; widget_133332_h_align = true; widget_133332_v_align = false; widget_133332__debug = false; widget_133332_id = 'Foo'; </script> <script src="http://some-widget-url.com/script?id=widget_133332"></script>
And within script?id=widget_133332
there will be something like this:
document.write('<div id="widget_133332">...</div>'); document.write('<div id="widget_133332_a_sec">...</div>'); document.write('<div id="widget_133332_b_sec">...</div>'); document.write('<div id="widget_133332_c_sec">...</div>');
I'm not complaining; it's not all that bad. However it could be done better; much better!
I decided to have a proper go at creating one of these. There were a couple of barriers to completion that required some extra work along the way; I'm releasing that extra work as a small stand-alone library that you can use within your 3rd party scripts. Here's an example chunk-of-code:
<script src="http://some-service.com/widget.js?id=2323"> ({ width: 200, height: 400, id: 'my-widget', keywords: ['apple', 'orange', 'banana'] }) </script>
Nicer to look at and much easier to use than the status quo! The
JSON-like syntax is very easy-to-follow, even if you've never seen
anything like it. The library used to enable this unique technique is
called embedHelper
.
The idea is that the user will copy a piece of code similar to that above on to their site. widget.js
(the 3rd party script) will contain this small helper-library plus the code required to make the widget work. embedHelper
gives you access to the configuration within the script tag, additionally it lets you access the query string within the src
attribute as key-value pairings (an object).
The pseudo-JSON within the SCRIPT
tag will be ignored by the browser because there is a src
attribute (that's why browsers look for the JavaScript). However we can still get at it via the innerHTML
DOM property. Then we can eval* the psuedo-JSON and use it within our 3rd party script.
* - For this purpose eval
(or (new Function())()
)
is okay to use in my opinion. The arguments against it do not outweigh
the clear benefits. Don't jump on the "eval is evil" bandwagon just for
the sake of it!
The following methods are available under the embedHelper
namespace:
embedHelper.getConfig( [ defaults1, defaults2 ] )
: This will return a configuration object, just as the user defined. If you have any default settings that you want to merge with the user's configuration (obviously giving the user's options precedence) then you can pass them as arguments (the last one will have precedence over previous ones).var defaults = { widgetColor: 'red', widgetBackgroundColor: 'white' }; var options = embedHelper.getConfig( defaults );
embedHelper.getQueryParams()
: This will return an object corresponding to the query string parameters included in thesrc
attribute of the "parent"SCRIPT
tag. This can be used as an alternative to configure the widget. As withgetConfig
you can pass default objects to this method too; note this was only added as a convenience - I doubt it'll be that useful.// E.g. <script src="http://url.com/script.js?foo=bar"></script> var query = embedHelper.getQueryParams(); query.foo; // => "bar"
embedHelper.insert( domArray | htmlString | domNode )
: This is a convenience function for those of you who are bound to claim thatdocument.write
is the only way to inject into the DOM at the position of the SCRIPT tag. This method does exactly that and accepts either a dom node (or fragment), an array of DOM nodes (or an array-like object - like jQuery's) , or an HTML string:/* These will be inserted at the position of the <SCRIPT/> tag */ embedHelper.insert('<div id="foo">...</div>'); embedHelper.insert( document.createElement('div') ); embedHelper.insert( [aDiv, anAnchor, aSpan] ); embedHelper.insert( jQuery('<div/>') );
embedHelper.scriptRef
: For advanced usage, you can get a reference to theSCRIPT
element.var script = embedHelper.scriptRef; // Note: this is not a function. jQuery('<div>Foo</div>').insertAfter(script);
No initialisation is needed before having access to
the above methods and properties; these methods can be called at any
time. It's best to place the helper "library" at the top of your widget.js
file (your 3rd party script). It's very important that it exists in the file requested from the SCRIPT
tag, not in another file request separately.
- Sent (0)
- New
Generate your business videos by AI with voice or just text
chatGPTaz.com
Talk to ChatGPT by your mother language
AppAIVideo
Your first FREE AI Video App
Deepfake Video
Deepfake AI Video Maker
Deepfake
Deepfake AI Video Maker
AI Deep Fake
Deepfake AI Video Maker
AIvidio
AI Video Mobile Solutions
AIvideos
AI Video Platform & Solutions
AIvedio
AI Video App Maker
Faceswap AI Online
Swap Faces Video, Photo & GIFs Instantly with Powerful AI Tools - Faceswap AI Online FREE
Faceswap AI Online
Swap Faces Video, Photo & GIFs Instantly with Powerful AI Tools - Faceswap AI Online FREE
Temu Free $500 for New Users
Claim Free Temu $500 Credit via Affiliate & Influencer Program
Free TikTok Ads Credit
Master TikTok Ads for Your Business Marketing
Dall-E-OpenAI.com
Generate creative images automatically with AI
chatGPT4.win
Talk to ChatGPT by your mother language
First AI Product from Elon Musk - Grok/UN.com
Speak to Grok AI Chatbot with Your Language
Tooly.win
Open tool hub for free to use by any one for every one with hundreds of tools
GateIO.gomymobi.com
Free Airdrops to Claim, Share Up to $150,000 per Project
iPhoneKer.com
Save up to 630$ when buy new iPhone 16
Buy Tesla Optimus Robot
Order Your Tesla Bot: Optimus Gen 2 Robot Today for less than $20k