开发者

jquery modal dialog seo friendly

Is jQuery modal dialog seo friendly? If not what changes can we make so that the content inside modal dialog can be easily read by the crawler?

Thanks in advance.

Edit: Sorry forgot to mention that the content in the modal is coming from server side. so it is 开发者_JAVA技巧using ajax as well.


If your dialog content just lives in the page and is "turned into a jquery modal dialog", then it will be part of the data that a crawler could access...If the content is loaded through ajax etc then that wouldn't be indexed as it requires javascript to run to populate the html.

...
<body>
<div id="MyModalDialog">
   This is content I want the search engine to index. As it exists in the page without needing any javascript to exist here, it could be indexed.
</div>
<input value="Show Dialog" id="ShowDialog" />
</body>
...

Edit
If the content requires javascript in any way and it wasn't already part of the original request, then you can basically assume a crawler will not index it.

Edit 2
If you wanted a strategy to overcome this. If you used a html link to open the dialog, provided the link opened the url correctly then you could always have a fallback for browsers/clients/crawlers that do not have javascript enabled, and then the content could be indexed...but it would be indexed under the original url...one that you might not want people entering your site against...

Something like this:

<div id="dialog">
</div>
<a href="/page/to/index/content" class="open-dialog">Open Dialog</a>

and the script

$(function() {

   $("a.open-dialog").click(function(e) {
       e.preventDefault();

       // get the url that this link is going to open
       var url = $(this).attr("href");

       // put contents in div and show dialog
       $("#dialog").load(url).dialog({modal:true});
   });

});

So a crawler would just follow the link from the a tag to the other content and potentially index it...hope that makes sense...otherwise the jquery code would cancel the link click and open the contents in the dialog.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜