0

私は、間もなく設立されるビジネスの Web サイトの開発に取り組んでおり、ナビゲーション ボタンが新しいウィンドウではなくiframeを対象とする単一のインデックス ページを開発することにしました。iframe に新しいターゲットが読み込まれるたびに、インデックス ページのタイトルタグを動的に更新する任意の言語で使用できるスクリプトはありますか? これに関するご意見をいただければ幸いです。どうもありがとうございました!

4

1 に答える 1

0

Using jQuery the code would look something like this:

​jQuery(document).ready(function(){
  jQuery('#myframe').load(function(){
    document.title="new title";
  });            
});​

But building your website like this has some serious drawbacks you might want to consider:

  • You will have to think of a way how people will land on the top frame if they find some sub site in their search engine of choice.
  • The changed page title will probably never be used by search engines as you are setting it with javascript (or the first issue applies).
  • Frames/Iframes cause memory leaks in IE (http://stackoverflow.com/questions/8407946/is-it-possible-to-use-iframes-in-ie-without-memory-leaks). This might only be a problem if your top frame will not be reloaded from time to time.
  • There might be problems when people try to print your website.
  • Your visitors might have problems when they try to bookmark a subsite of your website, as only the top frame will be bookmarked (not the content of the iframe).

...and I am sure there are many more issues with such a solution.

于 2012-07-20T23:44:19.810 に答える