Sponsored Content
The Lounge What is on Your Mind? Debugging Our Computer Science Trivia Feature Post 303040643 by Neo on Sunday 3rd of November 2019 02:04:15 AM
Old 11-03-2019
OK.. there is a problem with Safari and their Cross-Origin Resource Sharing (CORS) implementation, which is causing Javascript errors when ads or videos are served.

This bug is causing an error in the Trivia JS code, so I have am disabling the trivia for guests (not logged in) who are using Safari (for now, in both mobile and desktop):

Code:
<?php
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if ($vbulletin->userinfo['userid'] < '1') {
    if (stripos($user_agent, 'Chrome') !== false) {
        define('ENABLE_SAFARI_UA', true);
    } else {
        if (stripos($user_agent, 'Safari') !== false) {
            define('ENABLE_SAFARI_UA', false);
            $log = '/var/log/apache2/debug/neo_trivia_global_safari_debug.log';
            error_log(date(DATE_RFC822) . ' UA ' . $user_agent . "\n", 3, $log);
        } else {
            define('ENABLE_SAFARI_UA', true);
        }
    }
} else {
    define('ENABLE_SAFARI_UA', true);
}

I will think about another "fix" for this later.
 

7 More Discussions You Might Find Interesting

1. What is on Your Mind?

Computer Science and Information Technology

Hi, I haven't posted on the forums for a while now, I tried to find the most appropriate section for this post, but if this is in the wrong section please forgive me. First, let me say I'm a sophomore in HS. I know that job wise I definitely want to do something in computers. A while ago I was... (5 Replies)
Discussion started by: hpicracing
5 Replies

2. Programming

Is Web Development is a part of computer science ?

I am now a student in university in 2nd year. I am studying computer science. But I am not sure what type of jobs computer science provide. I know some of them are software programming or network management. Recently, I hear some about Web Development. I wonder if it is a part of computer science.... (1 Reply)
Discussion started by: Anna Hussie
1 Replies

3. Web Development

Is Web Development is a part of computer science ?

I am now a student in university in 2nd year. I am studying computer science. But I am not sure what type of jobs computer science provide. I know some of them are software programming or network management. Recently, I hear some about Web Development. I wonder if it is a part of computer... (3 Replies)
Discussion started by: Anna Hussie
3 Replies

4. What is on Your Mind?

Forum Trivial Pursuit - New Computer Science and Mathematics Trivia for UNIX.com

I have added a new experimental "Computer Science and Mathematics Trivia - True or False" section in the discussions, currently under the tags box. In the future, I plan to Expand this feature to add more trivia categories from math, science and technology. Keep track of correct and... (20 Replies)
Discussion started by: Neo
20 Replies

5. What is on Your Mind?

1000+ Computer Science Trivia Questions at UNIX.COM

The UNIX and Linux Forums now has over 1000 TRUE / FALSE computer science and computer related trivia question in our database. These questions are of relatively high quality (compared to similar sites on the web) and are fun (according to feedback by users). In the first week during the... (1 Reply)
Discussion started by: Neo
1 Replies

6. What is on Your Mind?

New Member and Country Computer Trivia Leaderboards

Thanks to Akshay, who helped me write the core MySQL queries, we now have two new draft leaderboards, by (1) member and by (2) country: https://www.unix.com/trivia_stats.php Currently milhan leads the members with a high score of 90%: ... (3 Replies)
Discussion started by: Neo
3 Replies

7. What is on Your Mind?

Computer Trivia Feature Tops 50,000 Questions Answered

Just noticed that our successful computer trivia feature (stats here) has surpassed over 50,000 questions answered by users: https://www.unix.com/trivia_stats.php This was a coding effort worth while and I'm pleased to see so many people enjoying it in such a short time since it was released... (3 Replies)
Discussion started by: Neo
3 Replies
SAFARIDRIVER(1) 					    BSD General Commands Manual 					   SAFARIDRIVER(1)

NAME
safaridriver -- Safari WebDriver REST API service SYNOPSIS
safaridriver -p port [-h | --help] [--enable] DESCRIPTION
The safaridriver utility is used to launch an HTTP server that implements the Selenium WebDriver REST API. When launched, safaridriver allows for automated testing of web content using the version of Safari that is installed with macOS. safaridriver supports several capabilities that can customize an automation session's behavior for a particular testing purpose. Capabilities are provided as arguments when requesting a new session. The capabilities supported by safaridriver are listed in the OPTIONS section below. Unless noted below, the values of requested capability keys are not read and are assumed to be true if present, and false otherwise. To use capabilities in your tests, please refer to the relevant 3rd-party documentation to learn how to request extra capabilities with the WebDriver client library that you are using. OPTIONS
Command line options -p, --port <port> Specifies the port on which the HTTP server should listen for incoming connections. If the port is already in use or otherwise unavailable, safaridriver will exit immediately with a non-zero return code. -h, --help Prints a usage message and exits. --enable Applies configuration changes so that subsequent WebDriver sessions will run without further authentication. This includes turning on Safari's Develop menu and checking "Enable Remote Automation" in the Develop menu. The user must authenticate via password for the changes to be applied. When this option is specified, safaridriver exits immediately without starting up the REST API service. If the changes were success- ful or already applied, safaridriver exits 0; otherwise, safaridriver exits >0 and prints an error message to stderr. Available capabilities safari:automaticInspection This capability instructs Safari to preload the Web Inspector and JavaScript debugger in the background prior to returning a newly- created window. To pause the test's execution in JavaScript and bring up Web Inspector's Debugger tab, you can simply evaluate a debugger; statement in the test page. safari:automaticProfiling This capability instructs Safari to preload the Web Inspector and start a Timeline recording in the background prior to returning a newly-created window. To view the recording, open the Web Inspector through Safari's Develop menu. webkit:WebRTC This capability allows a test to temporarily change Safari's policies for WebRTC and Media Capture. The value of the webkit:WebRTC capability is a dictionary with the following sub-keys, all of which are optional: DisableInsecureMediaCapture Normally, Safari refuses to allow media capture over insecure connections. This capability suppresses that restriction for testing purposes. For example, it would allow a test to exercise media capture code paths using a local test web server that is not configured to use HTTPS. DisableICECandidateFiltering To protect a user's privacy, Safari normally filters out WebRTC ICE candidates that correspond to internal network addresses when capture devices are not in use. This capability suppresses ICE candidate filtering so that both internal and external network addresses are always sent as ICE candidates. NOTES
For security reasons, the HTTP server accepts connections from localhost only. The HTTP server can accept connections from multiple test clients. Currently, only one Safari may be automated at a time, so it is not recommended to run multiple safaridriver instances at the same time. safaridriver is typically executed manually at the command line or automatically by a WebDriver client library. The Selenium project provides client libraries for most popular programming languages. More information is available on the Selenium project website: https://www.seleniumhq.org/ SEE ALSO
A summary of which REST API endpoints safaridriver supports, as well as the Safari version in which each endpoint became available, can be found on the Apple Developer website: https://developer.apple.com/ DIAGNOSTICS
The safaridriver utility exits 0 on success, and >0 if an error occurs. When a REST API command fails, safaridriver includes a detailed error message in the response. If you use a 3rd-party library on top of the REST API service, consult the library's documentation for how to access these error messages. STANDARDS
safaridriver implements the Selenium WebDriver JSON Wire Protocol as described by the Selenium WebDriver test suites and the protocol summary published here: https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol Darwin May 31, 2019 Darwin
All times are GMT -4. The time now is 08:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy