Force All Links on a Page to Open In a New Window

A neat little tag that I used recently to force all of the links within an iFrame page to open in a new window without having to update each link manually:

This worked great for updating the links in a Facebook specific iFrame, that way I could pull in dynamic content without having to update the WordPress post links, widgets, etc. to include taget=”_blank”.

I had direct access to the iFrame source, but I also found a script that may allow you to do this from the top level page where you are calling the iFrame as well.


$(document).ready(function()
{
var baseTag= document.createElement('base');
baseTag.target = '_blank';
$("iframe html head").append(baseTag);
});

MySql Find Replace String Function

I was looking to be able to find and replace references to a clients IP that were hard coded into product pages and such. Just a quick reference for myself and others whom may want to find and replace something from within a their database.

In order to use the following code I had to search for tables that contained what I wanted to replace. Then I could click on the table and find the specific row within the table that had the IP I wanted to replace. Type in the Table Name, then Row Name as well as what you are looking to find and replace with accordingly based on the following short code. The bolded items below have to be updated to match what you are trying to accomplish. Replace [] brackets text with appropriate info.

update [table_name] set [field_name] = replace([field_name],’[string_to_find]‘,’[string_to_replace]‘);

You may be able to find another database string function but I found this one safe and easy to use. It also allowed me to backup individual tables in case anything happened.