|
-
Aug 8th, 2011, 08:20 AM
#1
Including other javascript
Hi 
I'm trying to create a small widget for some of my friends's blogs.
The idea is, I'll give them a JavaScript code to them and they will paste that code in their blog(like Adsense). So, when rendered(ie. when some view that blog), they will see an image. Which upon clicked will popup a screen like in LightBox and will display some content inside it. The content will be generated dynamically. Means, a PHP page will be queried(which will be residing in my server) and the output of the query will be displayed in the LightBox kind of way.
Please enlighten me by providing some details on how to do this or solutions or where to start.
Thanks
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Aug 8th, 2011, 08:43 AM
#2
Re: Including other javascript
Found a good tutorial: http://www.quarkruby.com/2008/1/7/widget 
html Code:
<script type="text/javascript">
unique_key_each_host = "blah_123";
// some other variables ..
</script>
<script src="http://www.mysite.com/blah/blah-blah-blah.js"></script>
So, I could simply do a document.write to display a image with link. My question is, when this link is clicked, it would popup a LightBox kind of box. So, inorder to work, it needs the j-query core. How would I include it in the client side without making a collision on the various versions ? 
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Aug 8th, 2011, 08:54 AM
#3
Re: Including other javascript
Ok.. I have found that Google hosts that jquery in GoogleAPIs : http://encosia.com/3-reasons-why-you...query-for-you/
So, I have to just document.write:
html Code:
<script type="text/javascript"
src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
But what happens if the user had already included that jquery.js in that webpage ?
Will that conflict ? If so, how do I overcome it ?
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Aug 8th, 2011, 12:00 PM
#4
Re: Including other javascript
Ideally you shouldn't insert a third party library into someone's page; using a plain Javascript solution will give you better control over containing the scope of your script, and should be a lighter footprint on page load times.
But, if you're going with jQuery... you could include it conditionally...
Code:
if(typeof(jQuery) == "undefined"){
//include jquery library code
}
-
Aug 9th, 2011, 06:12 AM
#5
Re: Including other javascript
 Originally Posted by SambaNeko
using a plain Javascript solution will give you better control over containing the scope of your script, and should be a lighter footprint on page load times.
You mean I should try not to use third party APIs like jQuery ? 
 Originally Posted by SambaNeko
But, if you're going with jQuery... you could include it conditionally...
Code:
if(typeof(jQuery) == "undefined"){
//include jquery library code
}
So, document.write ? Or is there any other function like include() in PHP ?
Thanks
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|