Forum closed. New forum available at http://community.wymeditor.org/

Image src under Internet Explorer (inserting an img)

Support forum for WYMeditor.

Image src under Internet Explorer (inserting an img)

Postby dkellem on Mon Aug 16, 2010 2:04 pm

Hi,

I am working on a media plugin. If I insert <img src="/path/to/image.jpg" /> in Firefox all is good. Under Internet Explorer, the server hostname is always added and the code becomes <img src="http://my.server.com/path/to/image.jpg" />.

Also, if I switch to html view under Internet Explorer and remove the server name, then switch back to non-html view, then back to html view, the server name is added back in again.

Any idea how to prevent Internet Explorer from adding in the full server name on these URLs?

Thanks!
dkellem
 
Posts: 2
Joined: Mon Aug 16, 2010 1:59 pm

Re: Image src under Internet Explorer (inserting an img)

Postby dkellem on Mon Aug 16, 2010 3:36 pm

The issue is apparently with how new images are inserted.

Old code:
wym.insert ( '<img src="' + url + '" alt="' + alt + '" />' );

This causes problems under both firefox and IE if the full server name is included when switching between html view and regular view.

Better code:
var stamp = wym.uniqueStamp(); // get a unique identifier
wym.insert ( '<img src="' + stamp + '" />' ); // insert the new image. Browser specific problems seem to cause issues with link manipulation.
$("img[src$=" + stamp + "]", wym._doc.body).attr(WYMeditor.SRC, url).attr(WYMeditor.ALT, alt); // replace the url and alt tag _after_ the insert is complete.
dkellem
 
Posts: 2
Joined: Mon Aug 16, 2010 1:59 pm


Return to Support

Who is online

Users browsing this forum: No registered users and 3 guests