Jump to content

  • Log in with Facebook Log in with Twitter Log In with Google      Sign In   
  • Create Account

Subscribe to HRA Now!

 



SEO Class in Chicago, IL

Learn How To Optimize Your Website on July 26, 2013


Looking for personalized in-depth SEO training among your peers?



High Rankings is offering a 1-day customized SEO training class in Chicago. Class size is limited so please sign-up now if you want in!



 


Are you a Google Analytics enthusiast?

Share and download Custom Google Analytics Reports, dashboards and advanced segments--for FREE! 

 



 

 www.CustomReportSharing.com 

From the folks who brought you High Rankings!



Photo
- - - - -

Drop-list In I-frame


  • Please log in to reply
16 replies to this topic

#1 skater50

skater50

    HR 2

  • Members
  • PipPip
  • 11 posts

Posted 21 December 2004 - 06:22 PM

Hello!

If anyone can lend a hand on this, I'd be forever grateful...

Am using a drop-list for Category links on a catalog-style website. Everything works fine *until* I put the drop-list form into an I-frame.

The reason for putting the form into an I-frame is that the site has over 100 pages, so I don't want to change 100+ pages everytime we add a new category. So if the drop-list with the links goes into an I-frame, one central edit will change all the pages.

I have used this I-frame approach for simple HTML links and it works fine - but as soon as I add a *form* element (drop box) into the Iframe, the new page loads in the I-frame and not on top. I've added target="_top" to the form options but it doesn't make a difference - the new pages still load in the i-frame. omg.gif

The code snippets are below. If anyone can figure out how to get the new pages loading as "top" pages, not inside the Iframe, I'd be very grateful. Not to mention happy. Thankz!


Here's the HTML iframe code:

<iframe src="search.html" align=right height=70 width=100% marginwidth=0 marginheight=0 frameborder=0 scrolling=no>
</iframe>


And here's an abbreviated version (only one link) of the code being fed into the Iframe:



<form>
<select name="category" size="1 height=12px>" onChange="selectBoxLink(this.options[selectedIndex].value)">
<option selected>View by Category &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
<option>*****************</option>
<option value="http://www.sitename....y_carriers.htm" target="_top">Baby Carriers</option>
</select></form>


<script LANGUAGE="JavaScript">
<!--
function newWin(url,width,height) {
window.open(url,"remoteWin","width="+width+",height="+height+",resizable=1,menubar=0,status=0,scrollbars=1");
}

function selectBoxLink(anyUrl)
{
if (anyUrl.length > 0){
window.location = anyUrl;
}
return true;
}
//-->
</script>


Thanks for any help. thumbup1.gif

Skater50

#2 qwerty

qwerty

    HR 10

  • Moderator
  • 8,296 posts
  • Location:Somerville, MA

Posted 21 December 2004 - 06:29 PM

What if you tried using a server-side include instead of an IFrame? I've never done a dropdown in one, but I have a search form in an include file, and it works fine.

#3 Scottie

Scottie

    Psycho Mom

  • Admin
  • 6,294 posts
  • Location:Columbia, SC

Posted 21 December 2004 - 08:20 PM

I was going to suggest the same. And what a great opening to link to Simple Server Side Includes.

biggrin.gif

What is not mentioned in the article, skater50 is that you don't have to change your page extensions- you can set Apache to process htm files as php. It's a little more advanced and that's a beginner article. Still, it's not very difficult to do.

#4 chrishirst

chrishirst

    A not so moderate moderator.

  • Moderator
  • 5,888 posts
  • Location:Blackpool UK

Posted 21 December 2004 - 08:41 PM

Welcome to HR skater50 bye1.gif

apart from not using Iframes and going server side

your target parameter should be target="_parent" as there is no frameset and no top frame so you need it to open in the parent window.

#5 chrishirst

chrishirst

    A not so moderate moderator.

  • Moderator
  • 5,888 posts
  • Location:Blackpool UK

Posted 21 December 2004 - 08:53 PM

nice article Scottie


Now when mine on the same subject finally goes live on the cobblers kids website, I hope nobody thinks I've been copying biggrin.gif hmm.gif

#6 Connie

Connie

    HR 5

  • Active Members
  • PipPipPipPipPip
  • 428 posts
  • Location:The Hills of Missouri

Posted 21 December 2004 - 09:07 PM

That was a good article. I wonder why you did not go a little further and explain how SSI could also be used with .htm or .html pages?

#7 Ron Carnell

Ron Carnell

    HR 6

  • Moderator
  • 959 posts
  • Location:Michigan USA

Posted 21 December 2004 - 09:14 PM

I agree with Bob and Scottie. Using an include, either SSI or PHP, is a much better solution, both for you and probably for the user.

Having said that, and quickly adding I always avoid JavaScript as much as possible, the solution to your problem should be fairly simple. Your problem is in the line window.location = anyUrl; and exists because window.location refers to the window where the code resides -- which is obviously your iframe. You want to refer, instead, to the parent of the iframe.

Do a Google search on javascript parent iframe and I think you'll find some good references. I suspect (but have not tested) that parent.location = anyUrl; will do the trick for you.

#8 Ron Carnell

Ron Carnell

    HR 6

  • Moderator
  • 959 posts
  • Location:Michigan USA

Posted 21 December 2004 - 09:29 PM

Great article, Scottie! smile.gif

However, when you refer to ASP or PHP includes as Server Side Includes, or SSI, I think you risk diluting the language and possibly confusing some people. SSI, which usually requires page extensions of .shtml, is an entirely different preprocessor, quite apart from ASP or PHP. Unlike a true programming language, SSI's only function is provide included files, meaning it usually requires slightly less server overhead. Like ASP or PHP, however, the included files are completely transparent to the user (or spider).

If someone reads your article and asks their host about SSI, they're likely to get a very different answer than expected.

#9 Scottie

Scottie

    Psycho Mom

  • Admin
  • 6,294 posts
  • Location:Columbia, SC

Posted 21 December 2004 - 11:28 PM

OK OK, I'll run a follow up. biggrin.gif

It was meant to be simple and easy to understand for someone with a new 10-20 page website, truly my target audience. The small business do-it-yourselfer. I didn't want to get into too many details that would confuse.

But I did get lots of requests to expand the info, so I'll write a follow up with more details.

and Chris... mf_tongue.gif

#10 Connie

Connie

    HR 5

  • Active Members
  • PipPipPipPipPip
  • 428 posts
  • Location:The Hills of Missouri

Posted 22 December 2004 - 12:22 AM

Scottie as I said it was a good article if your on a windows server or have some knowledge of php and are using php pages.

How or can I use a php include on an html page?

Based on what I have read I think an include from a php include would use less server resources than an include for an shtml or html page.

Since I use a lot of SSI I would be glad to know how to save some resources with my html or htm pages. If SSI with php and html is compatible I think that should have been spelled out.

Personally I have never been able to get them to work together. That doesn't mean they won't but if they will I have never found anyone who explains how.

If php includes won't work with html then you need to explain how to use SSI with a html page. I would not use an shtml extension, but it is all fairly simple on an apache sever where you have the capability to upload an .htaccess file to get the server to parse htm or html files instead of the default shtml.

I'm not some one who is going to change to php. If php can be used in conjunction with html I will probably be one of the first to jump on board. On the other hand if it can't then you need to offer the html alternatives when they are available and let people know this only works if you use php etc.

#11 torka

torka

    Vintage Babe

  • Moderator
  • 4,392 posts
  • Location:Triangle area, NC, USA, Earth (usually)

Posted 22 December 2004 - 09:01 AM

Connie, you can use the .htaccess file to set HTML files to parse PHP commands, so you can use PHP on a page with an HTML extension. This means you can use PHP on existing HTML pages without changing the filenames.

Here's a thread that explains how. You'll have to scroll down a bit, but Randy's got a post in there with the correct syntax to use for the .htaccess file.

The downside to this, as I understand it, is that the server will have to preprocess every HTML page to see if it's got any PHP on it. So it's not something that you'd want to do when you only want to include PHP code on one or two pages of a much larger site. You'd be greatly increasing your server load for no good reason.

But for sitewide includes, sure, that would be a solution.

If your server is set up to parse PHP and you create new pages with PHP extensions, you certainly can use HTML on a PHP page as well.

HTH! smile.gif

--Torka mf_prop.gif

#12 Tom Philo

Tom Philo

    Photographer

  • Active Members
  • PipPipPipPipPip
  • 507 posts
  • Location:Beaverton, Oregon

Posted 22 December 2004 - 05:09 PM

Skater50

The reason why the IFrame method did not work is that it allows a complete web page (either on site, off an off site page) to be seen within another web page.

When it does that, the IFrame source as referenced has its own unique page reference points in the DOM (Document Object Model) and those references do not exist in the page that is calling the IFrame. So HTML references inside the IFrame reference THAT page's HTML DOM path so _TOP _Parent etc is relative to the page within the IFrame and so opens up in the Iframe.

You would have to code the source IFrame page replace the source page's DOM memory space in order for a link inside the IFrame to replace the source page when a link is clicked on. That is way too complicated and makes it harder to maintain when it is all done in code.

Server Side Includes (SSI) as explained is much simpler method.

#13 Connie

Connie

    HR 5

  • Active Members
  • PipPipPipPipPip
  • 428 posts
  • Location:The Hills of Missouri

Posted 22 December 2004 - 09:57 PM

torka Thanks for your reply. I think I will stick to what I know a little bit about.

AddHandler server-parsed .htm html in the .htaccess file

Include example <!--#include virtual="borders/doctype.inc" -->

It seems like any parsing is going to cost server resources regardless of how it is done so there is no reason for me to change.

I was just surprised with all the good information that Scottie provided in her article that she did not mention another area that would probably benefit a lot of people.

#14 skater50

skater50

    HR 2

  • Members
  • PipPip
  • 11 posts

Posted 23 December 2004 - 08:08 PM

Wow! Thanks so much to everyone who made suggestions. smile.gif

It's only my second post to this forum, but it's amazing how willing folks are to help & share what they know. I will digest all this tomorrow and try the solutions, and report back on the outcome.

Thanks again! cheers.gif

Skater 50

#15 skater50

skater50

    HR 2

  • Members
  • PipPip
  • 11 posts

Posted 23 December 2004 - 08:10 PM

unsure.gif embarrassed.gif

Oops - should have said it was my second *question* to this forum.... the screen tells me it is my 6th post...

Skater 50




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users