- Where Developers Learn, Share, & Build Careers


I will soon need to create a widget that some of our customers can embed on their website.

The embed code for my widget will be something like this for future proof:

  & lt; Script type = "text / javascript" src = "path / to / remote / file.js" & gt; & Lt; / Script & gt; & Lt; Div id = "my_widget" & gt; & Lt; / Div & gt;   

What are the strengths and weaknesses of iframes versus JSONP?

Is there any general SEO issues with IRMs? First, iframes and jsonp are not mutually exclusive: one means rendering one, the second is a communication. It means.

Your choice is between the inclusion of the document (which is creating a widget in the host DOM) or in-ifrim (which is a new, different DOM for the widget).

The advantage of an iframe is the sandbox: there is no conflict between your widget and the host's javascript and CSS. This means that you can safely:

  • You want to use / define any javascript library
  • Simple HTML with simple CSS rules Use code (which is a clear bonus for maintenance)

    For drawbacks:

    • An IFrame is heavy and the host page rendering is seriously
    • Iframe also

      Therefore, if people using your widget Micro believe will be ready to "optimization" is appropriate. For this go on their pages, in-documentary path. If not, then use the iframe, but understand the limitations.

      For SEO issues, unless you dynamically create a widget (whether it's in-document or with iframe), search engines will not see it. I do not know if you want but this is what you will get;)

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -