Set Iframe Source on Remote Page via URL Parameter

admin

Administrator
Staff member
I have 3 pages that I am working with.

<strong>shop_mobile.php</strong>

This page retrieves product data from MySQL db and lists formats it. It accepts the url parameters brand=BRANDNAME and cat=CATEGORY.

Here are two examples of this page in action:<br>
<a href="http://solanocycle.com/shop_mobile.php?brand=KYMCO&amp;cat=KYMCO Scooters" rel="nofollow noreferrer">http://solanocycle.com/shop_mobile.php?brand=KYMCO&amp;cat=KYMCO Scooters</a>

<a href="http://solanocycle.com/shop_mobile.php?brand=peacesports&amp;cat=Peace Sports Scooter" rel="nofollow noreferrer">http://solanocycle.com/shop_mobile.php?brand=peacesports&amp;cat=Peace Sports Scooter</a>

<strong>vehicles.html</strong>

This page contains links to view specific product listings pages (i.e. "KYMCO Scooters", "Peace Sports Scooters"). When these links are clicked, they should all take the user to the same page (view.html) but pass URL parameters which tell the Iframe within view.html which url to use as its source.

<strong>view.html</strong>

This page contains an Iframe which gets its source from the URL parameters passed by the links from vehicles.html

<em>Note:</em>

I tried using the solution provided at <a href="https://stackoverflow.com/questions...-url-parameter-to-an-iframe-in-wordpress-page">How do I pass URL parameter to an iFrame in Wordpress page?</a> to solve my problem, but I have never used jquery before and I was not able to get it working correctly.

Any help would be greatly appreciated.

<strong><em>More Info</em></strong>

Sample of a link from Vehicles.html

Code:
&lt;a href="view.html?http://solanocycle.com/shop_mobile.php?brand=KYMCO&amp;cat=KYMCO%20Scooters"&gt;KYMCO Scooters&lt;/a&gt;

What I think View.html should do:

<ol>
<li>Extract "<a href="http://solanocycle.com/shop_mobile.php?brand=KYMCO&amp;cat=KYMCO Scooters" rel="nofollow noreferrer">http://solanocycle.com/shop_mobile.php?brand=KYMCO&amp;cat=KYMCO Scooters</a>" from the url "view.html?<a href="http://solanocycle.com/shop_mobile.php?brand=KYMCO&amp;cat=KYMCO Scooters" rel="nofollow noreferrer">http://solanocycle.com/shop_mobile.php?brand=KYMCO&amp;cat=KYMCO Scooters</a>" and store it as a variable called $embedLink. </li>
<li>Display an Iframe with $embedLink as its source url.</li>
</ol>