Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Dynamically generated URL could not be opened in FireFox

Dynamically generated URL could not be opened in FireFox

Scheduled Pinned Locked Moved Web Development
questionhelptutorial
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AshishTijare
    wrote on last edited by
    #1

    * I have a code that generate form dynamically (form on a webpage is generated through code). The action attribute is set to 'TestMyPage.ashx'. When run, this URL is opened successfully in IE. * But when same value ('TestMyPage.ashx') is set for action attribute for FireFox, it do not load the said page. * When checked, for FireFox it loads the page only when it is prefixed with protocol, host and virtual directory information, like "protocol://localdomain/virtualdirectory/pagename.ashx" Example: "http://localhost:8795/myapp/TestMyPage.ashx" This url is successfully loaded by FireFox. But I don't want to set those prefixes (protocol, host, virtual dir.) myself. When searched on, it found that FireFox should also behave like IE in this case. So I could not guess what is the problem for such behaviour in my application (Is it because the form is generated dynamically?..) Any suggestion is welcome... Thank you.

    Ashish Software Engineer, Pune

    T A 2 Replies Last reply
    0
    • A AshishTijare

      * I have a code that generate form dynamically (form on a webpage is generated through code). The action attribute is set to 'TestMyPage.ashx'. When run, this URL is opened successfully in IE. * But when same value ('TestMyPage.ashx') is set for action attribute for FireFox, it do not load the said page. * When checked, for FireFox it loads the page only when it is prefixed with protocol, host and virtual directory information, like "protocol://localdomain/virtualdirectory/pagename.ashx" Example: "http://localhost:8795/myapp/TestMyPage.ashx" This url is successfully loaded by FireFox. But I don't want to set those prefixes (protocol, host, virtual dir.) myself. When searched on, it found that FireFox should also behave like IE in this case. So I could not guess what is the problem for such behaviour in my application (Is it because the form is generated dynamically?..) Any suggestion is welcome... Thank you.

      Ashish Software Engineer, Pune

      T Offline
      T Offline
      TylerBrinks
      wrote on last edited by
      #2

      What's wrong with prepending the http prefix?

      A 1 Reply Last reply
      0
      • T TylerBrinks

        What's wrong with prepending the http prefix?

        A Offline
        A Offline
        Anshumas
        wrote on last edited by
        #3

        :confused:please confirm Firefox is set your default browser?

        Anshuman Singh

        T 1 Reply Last reply
        0
        • A Anshumas

          :confused:please confirm Firefox is set your default browser?

          Anshuman Singh

          T Offline
          T Offline
          TylerBrinks
          wrote on last edited by
          #4

          I was addressing this comment in particular: But I don't want to set those prefixes (protocol, host, virtual dir.) myself. I'm just suggesting that you should set them yourself to get around the issue.

          A 1 Reply Last reply
          0
          • T TylerBrinks

            I was addressing this comment in particular: But I don't want to set those prefixes (protocol, host, virtual dir.) myself. I'm just suggesting that you should set them yourself to get around the issue.

            A Offline
            A Offline
            Anshumas
            wrote on last edited by
            #5

            can you provide me code for the same so that i can suggest you properly?

            Anshuman Singh

            A 1 Reply Last reply
            0
            • A Anshumas

              can you provide me code for the same so that i can suggest you properly?

              Anshuman Singh

              A Offline
              A Offline
              AshishTijare
              wrote on last edited by
              #6

              Below is the code for the same I am finding the solution. -----------------------------------

                if( isIE ) //Execute for Internet Explorer.
                {
                   var \_form = this.innerDocument.createElement('<form id = "UPLOADMYPAGE" method="post" enctype="multipart/form-data"  action="TestMyPage.ashx" />'); //The action attribute for IE requires to be pagename only. IE loads it properly.
                   var formHTML = \_form.outerHTML;
                   document.getElementById('MYFRAME').contentWindow.document.body.innerHTML = formHTML;
                }
                else //Execute for FireFox.
                {
                 var protocol = document.location.protocol;
                 var host = document.location.host;      
              
                  var \_form = document.createElement('form');
                  this.innerDocument.body.appendChild(\_form);
                 \_form.id = 'UPLOADMYPAGE';
                 \_form.name = 'UPLOADMYPAGE';
                 \_form.method = 'post';
                 \_form.enctype = 'multipart/form-data';
                 \_form.action = protocol + '//' + host + virtualDirectoryName + '/TestMyPage.ashx'; //The action attribute for FireFox requires to be prefixed with protocol, host and vir. dir. name to create url. Then only FireFox loads it properly, otherwise it could not load the page.
                }
                	  
              document.getElementById('MYFRAME').contentWindow.document.getElementById('UPLOADMYPAGE').submit();
              

              ------------------------------------------- //This is requirement from Code Testing Team. So I have to make it possible without using prefixes. //Please suggest how can this code be modified to provide only page name for action attribute in FireFox as in case of IE. I would like to know why FireFox is not doing it (as I have came to know that FireFox loads as that of IE).

              Ashish Software Engineer, Pune

              A 1 Reply Last reply
              0
              • A AshishTijare

                Below is the code for the same I am finding the solution. -----------------------------------

                  if( isIE ) //Execute for Internet Explorer.
                  {
                     var \_form = this.innerDocument.createElement('<form id = "UPLOADMYPAGE" method="post" enctype="multipart/form-data"  action="TestMyPage.ashx" />'); //The action attribute for IE requires to be pagename only. IE loads it properly.
                     var formHTML = \_form.outerHTML;
                     document.getElementById('MYFRAME').contentWindow.document.body.innerHTML = formHTML;
                  }
                  else //Execute for FireFox.
                  {
                   var protocol = document.location.protocol;
                   var host = document.location.host;      
                
                    var \_form = document.createElement('form');
                    this.innerDocument.body.appendChild(\_form);
                   \_form.id = 'UPLOADMYPAGE';
                   \_form.name = 'UPLOADMYPAGE';
                   \_form.method = 'post';
                   \_form.enctype = 'multipart/form-data';
                   \_form.action = protocol + '//' + host + virtualDirectoryName + '/TestMyPage.ashx'; //The action attribute for FireFox requires to be prefixed with protocol, host and vir. dir. name to create url. Then only FireFox loads it properly, otherwise it could not load the page.
                  }
                  	  
                document.getElementById('MYFRAME').contentWindow.document.getElementById('UPLOADMYPAGE').submit();
                

                ------------------------------------------- //This is requirement from Code Testing Team. So I have to make it possible without using prefixes. //Please suggest how can this code be modified to provide only page name for action attribute in FireFox as in case of IE. I would like to know why FireFox is not doing it (as I have came to know that FireFox loads as that of IE).

                Ashish Software Engineer, Pune

                A Offline
                A Offline
                AshishTijare
                wrote on last edited by
                #7

                Same code as above reply is posted again since comments added by me were not viewable (sorry for inconvenience). -------------------------------------------

                  if( isIE ) //Execute for Internet Explorer.
                  {
                     var \_form = this.innerDocument.createElement('<form id = "UPLOADMYPAGE" method="post" enctype="multipart/form-data"  action="TestMyPage.ashx" />'); 
                     //The above action attribute for IE requires to be pagename only. 
                     //IE loads it properly.
                
                     var formHTML = \_form.outerHTML;
                     document.getElementById('MYFRAME').contentWindow.document.body.innerHTML = formHTML;
                  }
                  else //Execute for FireFox.
                  {
                   var protocol = document.location.protocol;
                   var host = document.location.host;      
                    var \_form = document.createElement('form');
                    this.innerDocument.body.appendChild(\_form);
                   \_form.id = 'UPLOADMYPAGE';
                   \_form.name = 'UPLOADMYPAGE';
                   \_form.method = 'post';
                   \_form.enctype = 'multipart/form-data';
                   \_form.action = protocol + '//' + host + virtualDirectoryName + '/TestMyPage.ashx'; 
                
                   //The above action attribute for FireFox requires to be prefixed 
                   //with protocol, host and vir. dir. name to create url. Then only 
                   //FireFox loads it properly, otherwise it could not load the page.
                  }
                  	  
                document.getElementById('MYFRAME').contentWindow.document.getElementById('UPLOADMYPAGE').submit();
                

                ------------------------------------------- //This is requirement from Code Testing Team. So I have to make it possible without using prefixes. //Please suggest how can this code be modified to provide only page name for action attribute in FireFox as in case of IE. I would like to know why FireFox is not doing it (as I have came to know that FireFox loads as that of IE).

                Ashish Software Engineer, Pune

                A 1 Reply Last reply
                0
                • A AshishTijare

                  Same code as above reply is posted again since comments added by me were not viewable (sorry for inconvenience). -------------------------------------------

                    if( isIE ) //Execute for Internet Explorer.
                    {
                       var \_form = this.innerDocument.createElement('<form id = "UPLOADMYPAGE" method="post" enctype="multipart/form-data"  action="TestMyPage.ashx" />'); 
                       //The above action attribute for IE requires to be pagename only. 
                       //IE loads it properly.
                  
                       var formHTML = \_form.outerHTML;
                       document.getElementById('MYFRAME').contentWindow.document.body.innerHTML = formHTML;
                    }
                    else //Execute for FireFox.
                    {
                     var protocol = document.location.protocol;
                     var host = document.location.host;      
                      var \_form = document.createElement('form');
                      this.innerDocument.body.appendChild(\_form);
                     \_form.id = 'UPLOADMYPAGE';
                     \_form.name = 'UPLOADMYPAGE';
                     \_form.method = 'post';
                     \_form.enctype = 'multipart/form-data';
                     \_form.action = protocol + '//' + host + virtualDirectoryName + '/TestMyPage.ashx'; 
                  
                     //The above action attribute for FireFox requires to be prefixed 
                     //with protocol, host and vir. dir. name to create url. Then only 
                     //FireFox loads it properly, otherwise it could not load the page.
                    }
                    	  
                  document.getElementById('MYFRAME').contentWindow.document.getElementById('UPLOADMYPAGE').submit();
                  

                  ------------------------------------------- //This is requirement from Code Testing Team. So I have to make it possible without using prefixes. //Please suggest how can this code be modified to provide only page name for action attribute in FireFox as in case of IE. I would like to know why FireFox is not doing it (as I have came to know that FireFox loads as that of IE).

                  Ashish Software Engineer, Pune

                  A Offline
                  A Offline
                  AshishTijare
                  wrote on last edited by
                  #8

                  When I tried using below code it correctly worked. FireFox opened webpage mentioned in action attribute (page name without protocol, domain and virtual directory).

                  var f1 = document.createElement("form");
                  f1.id = 'MYFORM';
                  f1.name = 'MYFORM';
                  f1.method = 'post';
                  f1.action="TestPage.aspx";
                  alert(f1.action); //This shows complete url of page instead of only page name, as expected - correct.
                  this.document.body.appendChild(f1);
                  f1.submit();

                  I could not guess why in my main application's code (posted before this post) is not showing complete url when "alert" is done. In that it shows only the page name and not the complete url. Can anyone guess what might be the reason for this... Thank you.

                  Ashish Software Engineer, Pune

                  1 Reply Last reply
                  0
                  • A AshishTijare

                    * I have a code that generate form dynamically (form on a webpage is generated through code). The action attribute is set to 'TestMyPage.ashx'. When run, this URL is opened successfully in IE. * But when same value ('TestMyPage.ashx') is set for action attribute for FireFox, it do not load the said page. * When checked, for FireFox it loads the page only when it is prefixed with protocol, host and virtual directory information, like "protocol://localdomain/virtualdirectory/pagename.ashx" Example: "http://localhost:8795/myapp/TestMyPage.ashx" This url is successfully loaded by FireFox. But I don't want to set those prefixes (protocol, host, virtual dir.) myself. When searched on, it found that FireFox should also behave like IE in this case. So I could not guess what is the problem for such behaviour in my application (Is it because the form is generated dynamically?..) Any suggestion is welcome... Thank you.

                    Ashish Software Engineer, Pune

                    A Offline
                    A Offline
                    Anshumas
                    wrote on last edited by
                    #9

                    i had executed your code it has problem as you explained. i think you must document.createDocumentFragment('<form...)>it should work....if you get any problem or explanation then please reply me createElement--for IE createDocumentFragment-for Fire Fox

                    Anshuman Singh

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups