Is it possible to use character codes instead of in javascript?How do JavaScript closures work?What is the most efficient way to deep clone an object in JavaScript?How do I remove a property from a JavaScript object?Which equals operator (== vs ===) should be used in JavaScript comparisons?How do I include a JavaScript file in another JavaScript file?What does “use strict” do in JavaScript, and what is the reasoning behind it?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?Is it possible to apply CSS to half of a character?

Was there a dinosaur-counter in the original Jurassic Park movie?

What is the thing used to help pouring liquids called?

When referring to a person only by their surname, should I keep or omit "von"?

What does the coin flipping before dying mean?

How to preserve a rare version of a book?

How do I, as a DM, handle a party that decides to set up an ambush in a dungeon?

Books of scary stories with two or three plots each

In "Avengers: Endgame", what does this name refer to?

Some questions about antistatic wrist strap

Which version of the Squat Nimbleness feat is correct?

Can an Iranian citizen enter the USA on a Dutch passport?

Summer '19 Sandbox error: String index out of range: 0: Source

Collision domain question

How to replace space with '+' symbol in a triangular array?

Has the United States ever had a non-Christian President?

Is crescere the correct word meaning to to grow or cultivate?

What do you call a painting painted on a wall?

Is there a reason why Turkey took the Balkan territories of the Ottoman Empire, instead of Greece or another of the Balkan states?

How did the Apollo guidance computer handle parity bit errors?

How is trade in services conducted under the WTO in the absence of the Doha conclusion?

Is there precedent or are there procedures for a US president refusing to concede to an electoral defeat?

Can anyone identify this unknown 1988 PC card from The Palantir Corporation?

Endgame puzzle: How to avoid stalemate and win?

If an enemy monster charms one PC and tells them to attack a second PC, and then the second PC charms the monster, what happens?



Is it possible to use character codes instead of in javascript?


How do JavaScript closures work?What is the most efficient way to deep clone an object in JavaScript?How do I remove a property from a JavaScript object?Which equals operator (== vs ===) should be used in JavaScript comparisons?How do I include a JavaScript file in another JavaScript file?What does “use strict” do in JavaScript, and what is the reasoning behind it?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?For-each over an array in JavaScript?Is it possible to apply CSS to half of a character?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I'm using a perl script that generates an indexed search file for my website. Part of the functionality is that it excludes anything between < and > characters to avoid indexing tag contents. This has always worked fine, until recently when I included some javascript on all my pages that contains < and > characters.



Before I investigate modifying a perl script that I currently find bamboozling, I'm wondering if it's possible to use character codes instead of < and > characters in my javascript?



The specific lines of code that need < and > characters omitted are:



let foo = bar.filter(ele => parseInt(ele)>0 && ele.length ==4);


document.write('<link href="'+morefoo+'morebar.css"/>');









share|improve this question

















  • 4





    You probably should just skip searching text in your <script> tags entirely.

    – Patrick Roberts
    Mar 23 at 5:00











  • No it is not possible to do what you're asking.

    – Pointy
    Mar 23 at 5:03











  • Maybe possible with eval, but eval <shudder>

    – Jack Bashford
    Mar 23 at 5:05











  • @Sanjay if (a &lt; b) throws an error when parsed as JavaScript.

    – VLAZ
    Mar 23 at 5:47






  • 1





    This is an XY problem instead of changing all of your JS code, either fix your Perl script or simply load the JS from a separate file. The second one is probably the simplest possible solution that is most correct anyway. But the Perl code is likely to give you other trouble in the future that you probably don't anticipate right now.

    – VLAZ
    Mar 23 at 5:52

















0















I'm using a perl script that generates an indexed search file for my website. Part of the functionality is that it excludes anything between < and > characters to avoid indexing tag contents. This has always worked fine, until recently when I included some javascript on all my pages that contains < and > characters.



Before I investigate modifying a perl script that I currently find bamboozling, I'm wondering if it's possible to use character codes instead of < and > characters in my javascript?



The specific lines of code that need < and > characters omitted are:



let foo = bar.filter(ele => parseInt(ele)>0 && ele.length ==4);


document.write('<link href="'+morefoo+'morebar.css"/>');









share|improve this question

















  • 4





    You probably should just skip searching text in your <script> tags entirely.

    – Patrick Roberts
    Mar 23 at 5:00











  • No it is not possible to do what you're asking.

    – Pointy
    Mar 23 at 5:03











  • Maybe possible with eval, but eval <shudder>

    – Jack Bashford
    Mar 23 at 5:05











  • @Sanjay if (a &lt; b) throws an error when parsed as JavaScript.

    – VLAZ
    Mar 23 at 5:47






  • 1





    This is an XY problem instead of changing all of your JS code, either fix your Perl script or simply load the JS from a separate file. The second one is probably the simplest possible solution that is most correct anyway. But the Perl code is likely to give you other trouble in the future that you probably don't anticipate right now.

    – VLAZ
    Mar 23 at 5:52













0












0








0








I'm using a perl script that generates an indexed search file for my website. Part of the functionality is that it excludes anything between < and > characters to avoid indexing tag contents. This has always worked fine, until recently when I included some javascript on all my pages that contains < and > characters.



Before I investigate modifying a perl script that I currently find bamboozling, I'm wondering if it's possible to use character codes instead of < and > characters in my javascript?



The specific lines of code that need < and > characters omitted are:



let foo = bar.filter(ele => parseInt(ele)>0 && ele.length ==4);


document.write('<link href="'+morefoo+'morebar.css"/>');









share|improve this question














I'm using a perl script that generates an indexed search file for my website. Part of the functionality is that it excludes anything between < and > characters to avoid indexing tag contents. This has always worked fine, until recently when I included some javascript on all my pages that contains < and > characters.



Before I investigate modifying a perl script that I currently find bamboozling, I'm wondering if it's possible to use character codes instead of < and > characters in my javascript?



The specific lines of code that need < and > characters omitted are:



let foo = bar.filter(ele => parseInt(ele)>0 && ele.length ==4);


document.write('<link href="'+morefoo+'morebar.css"/>');






javascript






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 23 at 4:57









Dr_HoonDr_Hoon

256




256







  • 4





    You probably should just skip searching text in your <script> tags entirely.

    – Patrick Roberts
    Mar 23 at 5:00











  • No it is not possible to do what you're asking.

    – Pointy
    Mar 23 at 5:03











  • Maybe possible with eval, but eval <shudder>

    – Jack Bashford
    Mar 23 at 5:05











  • @Sanjay if (a &lt; b) throws an error when parsed as JavaScript.

    – VLAZ
    Mar 23 at 5:47






  • 1





    This is an XY problem instead of changing all of your JS code, either fix your Perl script or simply load the JS from a separate file. The second one is probably the simplest possible solution that is most correct anyway. But the Perl code is likely to give you other trouble in the future that you probably don't anticipate right now.

    – VLAZ
    Mar 23 at 5:52












  • 4





    You probably should just skip searching text in your <script> tags entirely.

    – Patrick Roberts
    Mar 23 at 5:00











  • No it is not possible to do what you're asking.

    – Pointy
    Mar 23 at 5:03











  • Maybe possible with eval, but eval <shudder>

    – Jack Bashford
    Mar 23 at 5:05











  • @Sanjay if (a &lt; b) throws an error when parsed as JavaScript.

    – VLAZ
    Mar 23 at 5:47






  • 1





    This is an XY problem instead of changing all of your JS code, either fix your Perl script or simply load the JS from a separate file. The second one is probably the simplest possible solution that is most correct anyway. But the Perl code is likely to give you other trouble in the future that you probably don't anticipate right now.

    – VLAZ
    Mar 23 at 5:52







4




4





You probably should just skip searching text in your <script> tags entirely.

– Patrick Roberts
Mar 23 at 5:00





You probably should just skip searching text in your <script> tags entirely.

– Patrick Roberts
Mar 23 at 5:00













No it is not possible to do what you're asking.

– Pointy
Mar 23 at 5:03





No it is not possible to do what you're asking.

– Pointy
Mar 23 at 5:03













Maybe possible with eval, but eval <shudder>

– Jack Bashford
Mar 23 at 5:05





Maybe possible with eval, but eval <shudder>

– Jack Bashford
Mar 23 at 5:05













@Sanjay if (a &lt; b) throws an error when parsed as JavaScript.

– VLAZ
Mar 23 at 5:47





@Sanjay if (a &lt; b) throws an error when parsed as JavaScript.

– VLAZ
Mar 23 at 5:47




1




1





This is an XY problem instead of changing all of your JS code, either fix your Perl script or simply load the JS from a separate file. The second one is probably the simplest possible solution that is most correct anyway. But the Perl code is likely to give you other trouble in the future that you probably don't anticipate right now.

– VLAZ
Mar 23 at 5:52





This is an XY problem instead of changing all of your JS code, either fix your Perl script or simply load the JS from a separate file. The second one is probably the simplest possible solution that is most correct anyway. But the Perl code is likely to give you other trouble in the future that you probably don't anticipate right now.

– VLAZ
Mar 23 at 5:52












2 Answers
2






active

oldest

votes


















0














Instead of



document.write('<link href="'+morefoo+'morebar.css"/>');


do this



var css = document.createElement('link');
css.href = morefoo+'morebar.css';
css.rel = 'stylesheet';
document.head.appendChild(css);
// or the last line for OLD browsers (i.e. IE)
document.getElementsByTagName('head'][0].appendChild(css);





share|improve this answer






























    0














    Here are some tips you can try:



    1. First Avoid arrow function, instead pass a anonymous function inside filter method and return the value explicitly.

    2. For the statement parseInt(ele)>0, use a function like isPositive(number). Create this method and load that method seperately before executing your actual file.

    3. As @Jaromanda mentioned in previous answer how you can you load stylesheet dynamically.

    These three steps will surely help you to meet your requirements.






    share|improve this answer























    • "Create this method and load that method seperately before executing your actual file" if doing that, why not just load all JavaScript separately to begin with, which means you wouldn't need to make a separate isPositive code?

      – VLAZ
      Mar 23 at 5:49











    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55310747%2fis-it-possible-to-use-character-codes-instead-of-and-in-javascript%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Instead of



    document.write('<link href="'+morefoo+'morebar.css"/>');


    do this



    var css = document.createElement('link');
    css.href = morefoo+'morebar.css';
    css.rel = 'stylesheet';
    document.head.appendChild(css);
    // or the last line for OLD browsers (i.e. IE)
    document.getElementsByTagName('head'][0].appendChild(css);





    share|improve this answer



























      0














      Instead of



      document.write('<link href="'+morefoo+'morebar.css"/>');


      do this



      var css = document.createElement('link');
      css.href = morefoo+'morebar.css';
      css.rel = 'stylesheet';
      document.head.appendChild(css);
      // or the last line for OLD browsers (i.e. IE)
      document.getElementsByTagName('head'][0].appendChild(css);





      share|improve this answer

























        0












        0








        0







        Instead of



        document.write('<link href="'+morefoo+'morebar.css"/>');


        do this



        var css = document.createElement('link');
        css.href = morefoo+'morebar.css';
        css.rel = 'stylesheet';
        document.head.appendChild(css);
        // or the last line for OLD browsers (i.e. IE)
        document.getElementsByTagName('head'][0].appendChild(css);





        share|improve this answer













        Instead of



        document.write('<link href="'+morefoo+'morebar.css"/>');


        do this



        var css = document.createElement('link');
        css.href = morefoo+'morebar.css';
        css.rel = 'stylesheet';
        document.head.appendChild(css);
        // or the last line for OLD browsers (i.e. IE)
        document.getElementsByTagName('head'][0].appendChild(css);






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 23 at 5:15









        Jaromanda XJaromanda X

        36.9k43255




        36.9k43255























            0














            Here are some tips you can try:



            1. First Avoid arrow function, instead pass a anonymous function inside filter method and return the value explicitly.

            2. For the statement parseInt(ele)>0, use a function like isPositive(number). Create this method and load that method seperately before executing your actual file.

            3. As @Jaromanda mentioned in previous answer how you can you load stylesheet dynamically.

            These three steps will surely help you to meet your requirements.






            share|improve this answer























            • "Create this method and load that method seperately before executing your actual file" if doing that, why not just load all JavaScript separately to begin with, which means you wouldn't need to make a separate isPositive code?

              – VLAZ
              Mar 23 at 5:49















            0














            Here are some tips you can try:



            1. First Avoid arrow function, instead pass a anonymous function inside filter method and return the value explicitly.

            2. For the statement parseInt(ele)>0, use a function like isPositive(number). Create this method and load that method seperately before executing your actual file.

            3. As @Jaromanda mentioned in previous answer how you can you load stylesheet dynamically.

            These three steps will surely help you to meet your requirements.






            share|improve this answer























            • "Create this method and load that method seperately before executing your actual file" if doing that, why not just load all JavaScript separately to begin with, which means you wouldn't need to make a separate isPositive code?

              – VLAZ
              Mar 23 at 5:49













            0












            0








            0







            Here are some tips you can try:



            1. First Avoid arrow function, instead pass a anonymous function inside filter method and return the value explicitly.

            2. For the statement parseInt(ele)>0, use a function like isPositive(number). Create this method and load that method seperately before executing your actual file.

            3. As @Jaromanda mentioned in previous answer how you can you load stylesheet dynamically.

            These three steps will surely help you to meet your requirements.






            share|improve this answer













            Here are some tips you can try:



            1. First Avoid arrow function, instead pass a anonymous function inside filter method and return the value explicitly.

            2. For the statement parseInt(ele)>0, use a function like isPositive(number). Create this method and load that method seperately before executing your actual file.

            3. As @Jaromanda mentioned in previous answer how you can you load stylesheet dynamically.

            These three steps will surely help you to meet your requirements.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 23 at 5:37









            santanu berasantanu bera

            445312




            445312












            • "Create this method and load that method seperately before executing your actual file" if doing that, why not just load all JavaScript separately to begin with, which means you wouldn't need to make a separate isPositive code?

              – VLAZ
              Mar 23 at 5:49

















            • "Create this method and load that method seperately before executing your actual file" if doing that, why not just load all JavaScript separately to begin with, which means you wouldn't need to make a separate isPositive code?

              – VLAZ
              Mar 23 at 5:49
















            "Create this method and load that method seperately before executing your actual file" if doing that, why not just load all JavaScript separately to begin with, which means you wouldn't need to make a separate isPositive code?

            – VLAZ
            Mar 23 at 5:49





            "Create this method and load that method seperately before executing your actual file" if doing that, why not just load all JavaScript separately to begin with, which means you wouldn't need to make a separate isPositive code?

            – VLAZ
            Mar 23 at 5:49

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55310747%2fis-it-possible-to-use-character-codes-instead-of-and-in-javascript%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현