facebook

Modify a html after generation

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #326756 Reply

    hammet
    Member

    Hi,

    I need to add this code to a generated HTML. It is easy but it is crazy to do it after any change in the .mobi screen and re-generation.
    Do you have any solution?
    Do you plan to generate some visual component to put pure javascript code on it from the editor?

    <script id=”smaatoAdDisplay” language=”javascript” type=”text/javascript”
    src=”http://soma.smaato.net/oapi/js/smaatoAdDisplay.js”&gt;
    </script>
    <script>
    (function() {
    var request = new SomaRequest();
    request.adSpaceID = xxx;
    request.publisherID = xxxx;
    SomaTag.requestAd(request);
    })();
    </script>

    Regards

    #326769 Reply

    Hi hammet,

    We’re working on an idea and will follow up tomorrow.

    #326841 Reply

    support-michael
    Keymaster

    Yes, will provide much more robust customization and control over the custom generated code. In the meantime here is an idea. Try dynamically loading and running your javascript. In your project’s <main_custom.js file add code similar to this to your phoneui.documentReadyHandler function:

    
    /**
     * Called when document is loaded.
     */
    phoneui.documentReadyHandler = function() {
       phoneui.loadJsAsync("http://soma.smaato.net/oapi/js/smaatoAdDisplay.js", function() {
            var request = new SomaRequest();
            request.adSpaceID = xxx;
            request.publisherID = xxxx;
            SomaTag.requestAd(request);
       });   
    }
    
    #326845 Reply

    hammet
    Member

    Many thanks for the effort!

    It was the first thing I tried but this .JS makes a document.write and, as it is done when the document is loaded it overwrites the body. 🙁

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Modify a html after generation

You must be logged in to post in the forum log in