GrabCode works great in all modern web browsers as far back as IE6 and works with nearly all RapidWeaver themes. Some basic style settings are included in the stack settings, enabling you to customise the GrabCode box size, font face and font size. Other styling can be applied by using custom CSS code and writing your own style rules against the .grabCode selector.

As a bonus, when a user clicks in the GrabCode box, all of the contents are automatically highlighted. So from that point, a user simply has to hit CTRL + C or CMD + C on their computer (again you can provide you own additional instructions for a user to follow).

Examples

HTML code

Use the GrabCode stack to present code snippets for things such as links. People can easily copy these code snippets and reuse them in their own websites.

Example output:
Visit the GrabCode page!
Click the code to select it, then press CTRL+C or CMD+C to copy it.

Promotional

Create affiliate links and badges which people can share via their websites and blog entries.

Example output:

Click the code to select it, then press CTRL+C or CMD+C to copy it.
GrabCode includes stack settings to adjust the font face, font size, width and height of the GrabCode box. You can safely use multiple GrabCode stacks on the same page. The content you want shown in the GrabCode box can be typed directly in the box, while you have RapidWeaver in Edit mode.

A note about copying code

Javascript does not permit highlighted content to be copied to a users clipboard automatically. This is done as a security measure and to safeguard against the end user inadvertently copying dangerous or malicious code into their computer clipboard. It is a sensible approach and one we should all respect. When you are browsing the internet and see buttons marked 'copy code' or similar, these are typically using Flash, not Javascript. Most computer users have the ability to use copy and paste functions without problem. You can provide basic instructions to tell a user what to do.
 

Contribute

If you find this stack element useful in your personal or commercial web projects; please consider making a small contribution towards ongoing support and updates. There are many different ways you can contribute to the Stacks4Stacks project, and benefits for doing so.
Bookmark or share this page
Baidu 百度
Blogger
Delicious
Digg
Facebook
Google+
LinkedIn
LiveJournal
MySpace
Одноклассники
Reddit
Renren 人人网
StumbleUpon
Tumblr
Twitter
ВКонтакте
Weibo 微博
XING
Contact Us
Email This Page
Print This Page
PS: This bookmarking and sharing popup is powered using our brilliant SocialPopup stack!

Cookies

Like a lot of websites, Stacks4Stacks uses cookies to help enhance your browsing experience and handle things like purchases. We take your privacy seriously, and welcome you to freely opt-out of nonessential cookies at any time by reviewing your preferences on this page.