?
Solved

Open new tab in Mobile Chrome

Posted on 2012-08-21
3
Medium Priority
?
1,857 Views
Last Modified: 2012-10-01
I am writing an ASP.net app for internal use.  

        If Request.Browser.Platform = "Unknown" Then
            If Request.Browser.Type = "Safari5" Then

                Response.Write("<script>")
                Response.Write("function openTab(url) {")
                Response.Write("var a = window.document.createElement(""a"");")
                Response.Write("a.target = '_blank';")
                Response.Write("a.href = url;")

                'Response.Write("// Dispatch fake click")
                Response.Write("var e = window.document.createEvent(""MouseEvents"");")
                Response.Write("e.initMouseEvent(""click"", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);")
                Response.Write("a.dispatchEvent(e);")
                Response.Write("};")
                Response.Write("openTab('./" & strFileName & "');")
                Response.Write("</script>")
            Else
                'Chrome'
                Dim outStream As MemoryStream = StreamToMemory(strfn)
                Response.Expires = 0
                Response.Buffer = True
                Response.ClearContent()

                Response.AddHeader("content-disposition", "inline; filename=" + strFileName)
                Response.ContentType = "Application/pdf"
                Response.BinaryWrite(outStream.ToArray())
                outStream.Close()

            End If
        Else

            Response.Write("<script>")
            Response.Write("window.open('./" & strFileName & "', '_tab');")
            Response.Write("</script>")
        End If

Open in new window


This code here works for all browsers by Chrome on the iPhone/iPad.

I was my file to open in a new windows or tab.  Its a pdf file.  Any suggestions?
0
Comment
Question by:PDIS
  • 2
3 Comments
 
LVL 23

Expert Comment

by:Roopesh Reddy
ID: 38330401
Hi,

You may have to use the same code - window.open()!

JavaScript doesn't differ from Mobile to Desktop!

Hope it helps u...
0
 

Author Comment

by:PDIS
ID: 38336538
I have tired to use the window.open().  When I did it the screen just flashes, and then doesn't load anything.
0
 
LVL 23

Accepted Solution

by:
Roopesh Reddy earned 2000 total points
ID: 38337437
Hi,

Just a try, did you allowed popup window in the settings of browser!

If disabled, enable it and try again!

Hope it helps u...
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
When you put your credit card number into a website for an online transaction, surely you know to look for signs of a secure website such as the padlock icon in the web browser or the green address bar.  This is one way to protect yourself from oth…
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…
How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question