<html>
<head>
<script type=”text/javascript” src=”jquery.js”></script>
</head>
<div id=”divId”>
<iframe src=”http://phpcodez.com” scrolling=”no” frameborder=”0″ style=”border: none; width: 90px; height: 20px; “></iframe>
</div>
<script type=”text/javascript”>
jQuery.noConflict();
jQuery(document).ready(function() {
if(jQuery(“#divId”+” iframe”).attr(‘src’).indexOf(“https”)<=-1) {
alert(“Its not a secure url”);
}
});
</script>
</html>
All posts by Pramod T P
jQuery check an element exist
<script type=”text/javascript”>
jQuery(document).ready(function() {
if ($(“#divId”).length > 0){
// your code here
}
});
</scrip
jQuery
jQuery is a multi-browser JavaScript library designed to simplify the client-side scripting of HTML. It was released in January 2006 at BarCamp NYC by John Resig. Used by over 55% of the 10,000 most visited websites, jQuery is the most popular JavaScript library in use today
jquery conflict
<script type=”text/javascript”>
jQuery.noConflict();
jQuery(document).ready(function() {
// Your code comes here
});
</script>
Include a static block on sidebar
<reference name=”left”>
<block type=”cms/block” name=”blockName” before=”-” >
<action method=”setBlockId”><block_id>block_identifier</block_id></action>
</block>
</reference>
Magento Ordering Sidebar Blocks
before=”-” – It lists as the first block
after=”-“- It lists as the last block
before=”block_name” – To load before a block
after=”block_name” – To load after a block
Check if a string exists javascript
<script type=”text/javascript”>
if(window.location.href.indexOf(“https:”) > -1) {
alert(“its a secure URL”);
}
</script>
Replace a string javascript
<script type=”text/javascript”>
var string=”PHPCode”;
string=string.replace(“Code”,”Codez”);
alert(string);
</script>
Completely disable any caching PHP
<?php
header(“Expires: Tue, 07 Aug 2000 08:00:00 GMT”);
header(“Last-Modified: ” . gmdate(“D, d M Y H:i:s”) . ” GMT”);
header(“Cache-Control: no-store, no-cache, must-revalidate, max-age=0”);
header(“Cache-Control: post-check=0, pre-check=0”, false);
header(“Pragma: no-cache”);
?>
Linux command to list only files
ls -la |grep ^-