I had a similar idea. Fortunately, it's a new project so I have some time to wait for a better solution. I guess before you look for the index of "<script" you could look for the index of "<!--[if" and if you find it use that as the location for insertion i.e.:
int insertIndex = tagIndex; if (content.toLowerCase().startsWith("<link") || content.toLowerCase().startsWith("<style")) { int ifIEIndex = responseContent.toLowerCase().indexOf("<!--[if"); if(ifIEIndex > 0 && ifIEIndex < insertIndex) { insertIndex = ifIEIndex; } else { int scriptIndex = responseContent.toLowerCase().indexOf("<script"); if (scriptIndex > 0 && scriptIndex < insertIndex) { insertIndex = scriptIndex; } } }
Not sure if that is the best solution but it seems to work.
Thanks again,
On Jun 25, 2012, at 12:48 PM, Amedeo Mantica wrote: A quick an dirty fix may be to add another script. An empty one. Call it void.js. Tomorrow I'll look for a better fix.
Amedeo
Sent from my iPhone On 25/giu/2012, at 23:13, Johnny Miller < email@hidden> wrote: Hi,
I've made the two updates (using ERXIEConditionalComment and using the static method from ERXResponseRewriter instead of AjaxUtils - although AjaxUtils just calls ERXResponseRewriter so that's not really a change).
But I'm still having the same issue. Looking through ERXResponseRewriter there is the static method insertInResponseBeforeTag that is being called and which has a block of code like this:
if (content.toLowerCase().startsWith("<link") || content.toLowerCase().startsWith("<style")) { int scriptIndex = responseContent.toLowerCase().indexOf("<script"); if (scriptIndex > 0 && scriptIndex < insertIndex) { insertIndex = scriptIndex; } } response.setContent(ERXStringUtilities.insertString(responseContent, content, insertIndex)); inserted = true;
So, because my first (and only script) in the head is inside the if IE conditional comment I believe that is why the stylesheet is being put in there.
Should I log a bug for this?
Thank you,
On Jun 23, 2012, at 11:16 AM, Amedeo Mantica wrote: Remember to put erxresponserewriter after super too. I'm not sure will solve. But try
Sent from my iPhone On 23/giu/2012, at 21:35, Johnny Miller < email@hidden> wrote: Hi Amedeo,
Ok. I'll try that.
re: why not use erxieconditionalcomment: just ignorance, now that I know about it I'll start using it. I should have realized that someone had created a simple solution for this already.
Thank you,
Johnny
Sent from my iPad On Jun 23, 2012, at 7:08 AM, Amedeo Mantica < email@hidden> wrote: put ERXResponseRewriter after the super of appendToResponse
one more thing;... why u don't use ERXIEConditionalComment ?
Amedeo
On 22/giu/2012, at 02:18, Johnny Miller wrote: Hi,
In my page wrapper's head section I have something like this:
// HTML <head> ... <webobject name = "IFLTIE9Open" /> <script src=""http://html5shim.googlecode.com/svn/trunk/html5.js">http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <webobject name = "IFIEClose" /> ... </head>
// WOD
IFIEClose : WOString { escapeHTML = false; value = "<![endif]-->"; }
IFLTIE9Open : WOString { escapeHTML = false; value = "<!--[if lt IE 9]>"; }
For some reason a stylesheet that gets added through addStylesheetResourceInHead function is stuffed in-between the IF IE tags.
Can someone please tell me how to fix this?
Thank you,
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
|