Unclosed tags

Vote:
 

Hi,

I am trying to add google variance testing on a page but when the page is rendered it removes the </unscript> tag from the page as it does not have an opening tag.

e.g

This is what I have coded on the page

<script>utmx_section("Slide images")</script>Content...     </noscript>   

but when the page is rendered on the website it removes the unscript closing tag

<script>utmx_section("Slide images")</script>Content...

 

I have tried various options in the episerver configuration section in the web.config but no success so far. Has anyone came accross the same problem? Any help would be appreciated

 

#42453
Aug 24, 2010 16:26
Vote:
 

When you say you have it coded in the page, do you mean in the page Template? If you are using a property it is true that the Xhtml property does processing on the HTML so it might be removed by that. In that case, try to use a longstring property and uncheck all the options for the longstring property.

#42454
Aug 24, 2010 17:09
Vote:
 

I have the code on the actual aspx page not in the page template.

    <div class="divSlideshowImage">
<script>utmx_section("Slide images")</script>Content...     </noscript>
    </div>

I can see the noscript tag in the actual aspx page but when it is rendered on the page the tag is removed.

#42455
Aug 24, 2010 17:30
Vote:
 

I can't see how this would happen - it should output pretty much anything you put in there which isn't interpreted as server tags. How do you notice in the client that the tag is missing? Is it really missing if you view the page source or view the http response content using for example firebug (not the default "html" view which shows a parsed and processed version)?

#42457
Aug 24, 2010 20:06
Vote:
 

I have viewed source of the page and the tags are missing on it. I have tried putting other unbalanced tags i.e only closing tags and they are all removed. I am using visual studio 2008 and have tried the same with a non episerver website and the tags are rendered as expected.

#42510
Aug 25, 2010 14:03
Vote:
 

I tried adding a single </noscript> inside a contentplaceholder of my default.aspx and it renders as expected. CMS 6, IIS 7, Windows 7.

#42511
Aug 25, 2010 14:10
Vote:
 

Interesting I am using CMS 5 , Windows 7 and Cassini Webserver/IIS 7 and tried the same as you and it doesn't work. I also tried it with Relate+ which is based on CMS6 and ti does not work for me.

 

<

 

asp:Content ID="Content1" ContentPlaceHolderID="MainRegion" runat="server">

 

</noscript>

 

<div class="leftCol">

and when it renders I viewd source and it doesn't show it.

 

   <div id="ctl00_UpdatePanel1">

    <div class="leftCol">
        <div id="ctl00_MainRegion_homeTabList_UpdPnlTabControl">
#42513
Aug 25, 2010 14:24
Vote:
 

I have tried this on a brand new episerver website. I used CMS 6 , IIS7 and windows 7 and it still removes the unbalanced tag. I am not sure how it is working for you. Is there anyone else who is having the same issue

#42519
Aug 25, 2010 17:00
Vote:
 

My guess would be that it is removed by the HTML Rewrite filter used by the Friendly URL rewriter. Try to change your URL Rewrite provider to NullUrlRewriteProvider and if that fixes your issue you know where the problem lies.

Out of curiosity, why would you want an unbalanced element to begin with?

Cheers
Henrik

#42536
Aug 26, 2010 4:02
Vote:
 

I think that might have been spot on Henrik! It so happens that the site where I tested didn't use FURLs. Tried it again now in a new CMS 6 site and the unbalanced </noscript> is indeed removed.

Mohammed, I'm sorry for not recognizing this right away.

#42537
Aug 26, 2010 6:47
Vote:
 

Thanks Henrik and Magnus. It works without friendly Url turned on but I need the friendly Url module turned on because of SEO stuff. Any suggestion how  to get around this problem? The reason I am using unbalanced tag is google multi variant testing which requires the script to be written with an unbalanced tag. e.g

<script>utmx_section("Slide images")</script>Content...     </noscript>

#42549
Aug 26, 2010 10:42
Vote:
 

You could get the unbalanced tag in the document by using javascript and document.write, but that might upset the test...

#42550
Aug 26, 2010 10:46
Vote:
 

Yes, my suggestion was of course not to turn off the FriendlyURL rewriter for anything else but to confirm that this was the problem.

For a discussion on how make the Google multi variant test work with valid XHTML can be found at: http://groups.google.com/group/gwotechnical/msg/010a33ac65e9515c.

Don't know much about it myself though. Good luck!

#42603
Aug 27, 2010 0:23
Vote:
 

I have this exact problem now. Is there still no solution?

#55634
Dec 09, 2011 15:56
Vote:
 

Could you use this old module to make it work?

https://www.coderesort.com/p/epicode/wiki/GoogleAnalytics 

#55637
Dec 09, 2011 16:06
Vote:
 

I'm afraid not, even tho I don't know the internals of that module. But it seems it's mainly for including GA? I need to enter invalid html in the middle of an .aspx page (like this: <script>utmx_section("Slide images")</script>Content...     </noscript>), but with Friendly URL turned on the </noscript> bit of the snipplet is removed.

It's weird that Google requires us to write invalid html, but according to the following page there is no alternative:

http://support.google.com/websiteoptimizer/bin/answer.py?hl=en&answer=64418

#55639
Dec 09, 2011 16:15
Vote:
 

I did not implement a proper solution but I fixed my issue by writing a new module. I did not have a friendly url requirement for the google variation page so I excluded the specific page in my module

 

Add a module in Web.config 

<urlRewrite defaultProvider="FriendlyUrlRewriteProvider">
<providers>
<add name="EPiServerFriendlyUrlRewriteProvider" description="EPiServer standard Friendly URL rewriter" type="EPiServer.Web.FriendlyUrlRewriteProvider,EPiServer" />  
 </providers>

 Module code

 

using System;
using System.Web;
using EPiServer.Web;
using System.IO;
using System.Text;

namespace EPiServer
{
public class FriendlyUrlModule : EPiServer.Web.FriendlyUrlRewriteProvider
{

public override HtmlRewriteToExternal GetHtmlRewriter()
{
if (HttpContext.Current.Request.Url.AbsoluteUri.ToLower().Contains("URLTOREMOVE"))
{
return new NullHtmlRewriteToExternal();
}
else
{
return new FriendlyHtmlRewriteToExternal(UrlRewriteProvider.RebaseKind);
}

}

}

// Hack to remove html validation for the google web optimizer
internal class NullHtmlRewriteToExternal : HtmlRewriteToExternal
{
// Methods
public override Stream GetRewriteFilter(UrlBuilder internalUrl, UrlBuilder externalUrl, Encoding encoding, Stream stream, out RewritePipe rewritePipe)
{
rewritePipe = new NullRewritePipe();
return stream;
}

public override string RewriteString(UrlBuilder internalUrl, UrlBuilder externalUrl, Encoding encoding, string html)
{
return html;
}
}

 

It should not be hard to make it work with friendlyUrl but I did not try it.

 

#55640
Dec 09, 2011 16:35